After updating to Storybook 10 (with Angular), compilation crash with: import_meta.resolve is not a function
#33173
-
|
I was not able to run Storybook in my project after upgrading to v10.x. It was running fine in 9.x. I tried all those different combinations: Here is the whole error from the logs: This is the code involved in the browser chunk: var importMetaResolve = (...args) => typeof import.meta.resolve != "function" && process.env.VITEST === "true" ? (console.warn(
"importMetaResolve from within Storybook is being used in a Vitest test, but it shouldn't be. Please report this at https://github.com/storybookjs/storybook/issues/new?template=bug_report.yml"
), pathToFileURL2(args[0]).href) : import.meta.resolve(...args), resolvePackageDir = (pkg, parent) => {
try {
return dirname(fileURLToPath2(importMetaResolve(join(pkg, "package.json"), parent)));
} catch {
return dirname(fileURLToPath2(importMetaResolve(join(pkg, "package.json"))));
}
}, isTypescriptLoaderRegistered = !1;I tried to replicate this, but in another Angular project it ran without any issues. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
Hi @JeanRemiDelteil! I'm Dosu and I’m helping the storybook team. Storybook 10 switched to ESM-only and now uses import.meta.resolve for module resolution, which only works if your config files and environment are fully ESM-compliant. This error usually means Storybook is running in a CommonJS context or your .storybook/main.* or custom preset files are not valid ESM modules. Even if your Node version is new enough, any CJS config or extensionless import can break things cite cite. Here’s what to check:
If you update your configs and still see the error, check for any dependencies or scripts that might be running Storybook in a CJS context. Let me know if you want a checklist or example config! To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
-
|
After further investigation and tests, nothing in the Storybook configuration or code had any leverage on this issue. |
Beta Was this translation helpful? Give feedback.
After further investigation and tests, nothing in the Storybook configuration or code had any leverage on this issue.
It was caused by a configuration or a cache issue (probably) in Jetbrains IDE.
Deleting the .idea/ folder solved the issue...