Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

chore(storybook): fix `__dirname` issue (#6143)

白熱8c6fb5b20bc0
diff --git a/common/storybook/.storybook/main.ts b/common/storybook/.storybook/main.ts
index ab3ac3c1f6..fdf930069f 100644
--- a/common/storybook/.storybook/main.ts
+++ b/common/storybook/.storybook/main.ts
@@ -18,9 +18,11 @@ import type { StorybookConfig } from '@storybook/react-webpack5';
import type { StoriesEntry } from 'storybook/internal/types';
import { existsSync, readdirSync } from 'node:fs';
import { resolve } from 'node:path';
-
+import { pathToFileURL } from 'node:url';
import TsconfigPathsPlugin from 'tsconfig-paths-webpack-plugin';
+const __dirname = pathToFileURL(new URL('.', import.meta.url).pathname).pathname;
+
const tsconfigPathsPlugin = new TsconfigPathsPlugin({
configFile: resolve(__dirname, '../tsconfig.storybook.json'),
extensions: ['.ts', '.tsx', '.js'],