You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the package.json is "type": "module" and there is "import": "./dist/preset.mjs".
There's a file called storybook-solidjs-vite/dist/preset.js that contains commonjs (module.exports).
There's no file named storybook-solidjs-vite/dist/preset.mjs.
Resulting error in Node 22:
[SB] info => Cleaning outputDir: storybook-static
[SB] info => Loading presets
[SB] SB_CORE-SERVER_0002 (CriticalPresetLoadError): Storybook failed to load the following preset: storybook-solidjs-vite/preset.
[SB]
[SB] Please check whether your setup is correct, the Storybook dependencies (and their peer dependencies) are installed correctly and there are no package version clashes.
[SB]
[SB] If you believe this is a bug, please open an issue on Github.
[SB]
[SB] ReferenceError: module is not defined
[SB] at file:///project/node_modules/.pnpm/[email protected]_@[email protected][email protected]_stor_9bc8418f99ab4125250afe575d87f224/node_modules/storybook-solidjs-vite/dist/preset.js:1:1009
[SB] at ModuleJobSync.runSync (node:internal/modules/esm/module_job:395:35)
[SB] at ModuleLoader.importSyncForRequire (node:internal/modules/esm/loader:360:47)
[SB] at loadESMFromCJS (node:internal/modules/cjs/loader:1385:24)
[SB] at Module._compile (node:internal/modules/cjs/loader:1536:5)
[SB] at node:internal/modules/cjs/loader:1706:10
[SB] at Object.newLoader (/project/node_modules/.pnpm/[email protected][email protected]/node_modules/esbuild-register/dist/node.js:2262:9)
[SB] at extensions..js (/project/node_modules/.pnpm/[email protected][email protected]/node_modules/esbuild-register/dist/node.js:4833:24)
[SB] at Module.load (node:internal/modules/cjs/loader:1289:32)
[SB] at Function._load (node:internal/modules/cjs/loader:1108:12)
Expected behavior
Either change package.jsontype to commonjs or publish the code as a module.
Screenshots and/or logs
Shown above
Environment
OS: MacOS, Linux
Node.js version: 22
NPM version: pnpm 10
Additional context
I wasn't able to reproduce this with the example in this repo, maybe because of how the yarn monorepo works and the source being available.
The text was updated successfully, but these errors were encountered:
Well after yarn build in parent dir, I was able to cd into example and run yarn storybook
Had to modify example/main.ts slightly
import { createRequire } from 'module'; // Import createRequire
const require = createRequire(import.meta.url); // Create a require function
Was giving me this error before.
PS G:\dev\boop\solidjs\example> yarn storybook
@storybook/core v9.0.0-alpha.1
SB_CORE-SERVER_0007 (MainFileEvaluationError): Storybook couldn't evaluate your .storybook\main.ts file.
Original error:
ReferenceError: require is not defined
at getAbsolutePath (\.storybook\main.ts:10:18)
at \.storybook\main.ts:15:5
Describe the bug
A clear and concise description of what the bug is.
Steps to reproduce the behavior
package.json
is"type": "module"
and there is"import": "./dist/preset.mjs"
.storybook-solidjs-vite/dist/preset.js
that contains commonjs (module.exports).storybook-solidjs-vite/dist/preset.mjs
.Resulting error in Node 22:
Expected behavior
Either change
package.json
type
tocommonjs
or publish the code as a module.Screenshots and/or logs
Shown above
Environment
Additional context
I wasn't able to reproduce this with the example in this repo, maybe because of how the yarn monorepo works and the source being available.
The text was updated successfully, but these errors were encountered: