diff --git a/apps/browser/src/autofill/content/components/.lit-storybook/main.ts b/apps/browser/src/autofill/content/components/.lit-storybook/main.ts index a316d8f5baa..53c06264672 100644 --- a/apps/browser/src/autofill/content/components/.lit-storybook/main.ts +++ b/apps/browser/src/autofill/content/components/.lit-storybook/main.ts @@ -1,9 +1,16 @@ -import path, { dirname, join } from "path"; +import { createRequire } from "module"; +import { dirname, join, resolve } from "path"; +import { fileURLToPath } from "url"; import type { StorybookConfig } from "@storybook/web-components-webpack5"; import remarkGfm from "remark-gfm"; import TsconfigPathsPlugin from "tsconfig-paths-webpack-plugin"; +const currentFile = fileURLToPath(import.meta.url); +const currentDirectory = dirname(currentFile); + +const require = createRequire(import.meta.url); + const getAbsolutePath = (value: string): string => dirname(require.resolve(join(value, "package.json"))); @@ -43,7 +50,7 @@ const config: StorybookConfig = { if (config.resolve) { config.resolve.plugins = [ new TsconfigPathsPlugin({ - configFile: path.resolve(__dirname, "../../../../../tsconfig.json"), + configFile: resolve(currentDirectory, "../../../../../tsconfig.json"), }), ] as any; }