Open AdrianBobak opened 1 year ago
Interesting. I'm hitting a similar error with Storybook for HTML / Webpack5, but only on npm run build
. Happens with Storybook 7.1 and above for me. Looks like this:
info Addon-docs: using MDX2
info => Using implicit CSS loaders
info => Using default Webpack5 setup
10% building 0/1 entries 0/0 dependencies 0/0 modulesERR! TypeError: Converting circular structure to JSON
ERR! --> starting at object with constructor 'Array'
ERR! | index 46 -> object with constructor 'Object'
ERR! | property 'loc' -> object with constructor 'SourceLocation'
ERR! --- property 'tokens' closes the circle
ERR! at JSON.stringify (<anonymous>)
ERR! at enter (/[path]/node_modules/@storybook/csf-tools/dist/index.js:18:5390)
ERR! at NodePath._call (/[path]/node_modules/@babel/traverse/lib/path/context.js:46:20)
ERR! at NodePath.call (/[path]/node_modules/@babel/traverse/lib/path/context.js:36:17)
ERR! at NodePath.visit (/[path]/node_modules/@babel/traverse/lib/path/context.js:82:31)
ERR! at TraversalContext.visitQueue (/[path]/node_modules/@babel/traverse/lib/context.js:86:16)
ERR! at TraversalContext.visitMultiple (/[path]/node_modules/@babel/traverse/lib/context.js:61:17)
ERR! at TraversalContext.visit (/[path]/node_modules/@babel/traverse/lib/context.js:107:19)
ERR! at traverseNode (/[path]/node_modules/@babel/traverse/lib/traverse-node.js:22:17)
ERR! at NodePath.visit (/[path]/node_modules/@babel/traverse/lib/path/context.js:88:52)
I'm using:
@storybook/addon-a11y
@storybook/addon-essentials
@storybook/addon-styling
@storybook/addons
@storybook/html-webpack5
@storybook/theming
@yannbf could this be related to the new error reporting?
@yannbf could this be related to the new error reporting?
Definitely, somehow telejson not handling circular dependencies properly
Using latest storybook over here and we can reproduce this one issue as well, if it helps here's our .storybook/main.js:
// https://github.com/storybookjs/storybook/issues/24013
export default {
stories: ["../src/**/*.stories.@(js|jsx|ts|tsx)"],
staticDirs: ["../public"],
addons: [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-interactions",
"@storybook/preset-create-react-app",
],
framework: {
name: "@storybook/react-webpack5",
options: {},
},
features: {
emotionAlias: false,
},
core: {
builder: "@storybook/builder-vite",
disableTelemetry: true, // 👈 Disables telemetry
},
docs: {
autodocs: false,
},
};
Interesting. I'm hitting a similar error with Storybook for HTML / Webpack5, but only on
npm run build
. Happens with Storybook 7.1 and above for me. Looks like this:info Addon-docs: using MDX2 info => Using implicit CSS loaders info => Using default Webpack5 setup 10% building 0/1 entries 0/0 dependencies 0/0 modulesERR! TypeError: Converting circular structure to JSON ERR! --> starting at object with constructor 'Array' ERR! | index 46 -> object with constructor 'Object' ERR! | property 'loc' -> object with constructor 'SourceLocation' ERR! --- property 'tokens' closes the circle ERR! at JSON.stringify (<anonymous>) ERR! at enter (/[path]/node_modules/@storybook/csf-tools/dist/index.js:18:5390) ERR! at NodePath._call (/[path]/node_modules/@babel/traverse/lib/path/context.js:46:20) ERR! at NodePath.call (/[path]/node_modules/@babel/traverse/lib/path/context.js:36:17) ERR! at NodePath.visit (/[path]/node_modules/@babel/traverse/lib/path/context.js:82:31) ERR! at TraversalContext.visitQueue (/[path]/node_modules/@babel/traverse/lib/context.js:86:16) ERR! at TraversalContext.visitMultiple (/[path]/node_modules/@babel/traverse/lib/context.js:61:17) ERR! at TraversalContext.visit (/[path]/node_modules/@babel/traverse/lib/context.js:107:19) ERR! at traverseNode (/[path]/node_modules/@babel/traverse/lib/traverse-node.js:22:17) ERR! at NodePath.visit (/[path]/node_modules/@babel/traverse/lib/path/context.js:88:52)
I'm using:
@storybook/addon-a11y
@storybook/addon-essentials
@storybook/addon-styling
@storybook/addons
@storybook/html-webpack5
@storybook/theming
I am also seeing this one as well on build
Happens even if I disable all addons
Interesting. I'm hitting a similar error with Storybook for HTML / Webpack5, but only on
npm run build
. Happens with Storybook 7.1 and above for me. Looks like this:info Addon-docs: using MDX2 info => Using implicit CSS loaders info => Using default Webpack5 setup 10% building 0/1 entries 0/0 dependencies 0/0 modulesERR! TypeError: Converting circular structure to JSON ERR! --> starting at object with constructor 'Array' ERR! | index 46 -> object with constructor 'Object' ERR! | property 'loc' -> object with constructor 'SourceLocation' ERR! --- property 'tokens' closes the circle ERR! at JSON.stringify (<anonymous>) ERR! at enter (/[path]/node_modules/@storybook/csf-tools/dist/index.js:18:5390) ERR! at NodePath._call (/[path]/node_modules/@babel/traverse/lib/path/context.js:46:20) ERR! at NodePath.call (/[path]/node_modules/@babel/traverse/lib/path/context.js:36:17) ERR! at NodePath.visit (/[path]/node_modules/@babel/traverse/lib/path/context.js:82:31) ERR! at TraversalContext.visitQueue (/[path]/node_modules/@babel/traverse/lib/context.js:86:16) ERR! at TraversalContext.visitMultiple (/[path]/node_modules/@babel/traverse/lib/context.js:61:17) ERR! at TraversalContext.visit (/[path]/node_modules/@babel/traverse/lib/context.js:107:19) ERR! at traverseNode (/[path]/node_modules/@babel/traverse/lib/traverse-node.js:22:17) ERR! at NodePath.visit (/[path]/node_modules/@babel/traverse/lib/path/context.js:88:52)
I'm using:
@storybook/addon-a11y
@storybook/addon-essentials
@storybook/addon-styling
@storybook/addons
@storybook/html-webpack5
@storybook/theming
@MichaelAllenWarner I tracked this error down to having a root .storybook folder in an Nx monorepoe. If I remove that folder the error goes away.
@ryan-mcginty-alation Thanks for the info. I'm not using Nx, but I do have a root .storybook
folder. Don't think I can remove it though!
Interesting. I'm hitting a similar error with Storybook for HTML / Webpack5, but only on
npm run build
. Happens with Storybook 7.1 and above for me. Looks like this:info Addon-docs: using MDX2 info => Using implicit CSS loaders info => Using default Webpack5 setup 10% building 0/1 entries 0/0 dependencies 0/0 modulesERR! TypeError: Converting circular structure to JSON ERR! --> starting at object with constructor 'Array' ERR! | index 46 -> object with constructor 'Object' ERR! | property 'loc' -> object with constructor 'SourceLocation' ERR! --- property 'tokens' closes the circle ERR! at JSON.stringify (<anonymous>) ERR! at enter (/[path]/node_modules/@storybook/csf-tools/dist/index.js:18:5390) ERR! at NodePath._call (/[path]/node_modules/@babel/traverse/lib/path/context.js:46:20) ERR! at NodePath.call (/[path]/node_modules/@babel/traverse/lib/path/context.js:36:17) ERR! at NodePath.visit (/[path]/node_modules/@babel/traverse/lib/path/context.js:82:31) ERR! at TraversalContext.visitQueue (/[path]/node_modules/@babel/traverse/lib/context.js:86:16) ERR! at TraversalContext.visitMultiple (/[path]/node_modules/@babel/traverse/lib/context.js:61:17) ERR! at TraversalContext.visit (/[path]/node_modules/@babel/traverse/lib/context.js:107:19) ERR! at traverseNode (/[path]/node_modules/@babel/traverse/lib/traverse-node.js:22:17) ERR! at NodePath.visit (/[path]/node_modules/@babel/traverse/lib/path/context.js:88:52)
I'm using:
@storybook/addon-a11y
@storybook/addon-essentials
@storybook/addon-styling
@storybook/addons
@storybook/html-webpack5
@storybook/theming
Thought I'd add that I can't get around this storybook build
error by disabling telemetry (even with the STORYBOOK_DISABLE_TELEMETRY=1 storybook build
approach -- is that the right syntax?).
Could this be related to #23604? https://github.com/storybookjs/storybook/issues/23604#issuecomment-1664135522 fixed for me
Could this be related to #23604? #23604 (comment) fixed for me
That indeed was my problem! Many thanks!
Describe the bug
After opening Storybook in the browser there's an following error:
It doesn't seem to break any functionality. I got this error after upgrading Storybook but it also occurred when I tried to install it on the project that doesn't have SB in the past. Tested with node 16.17.0 and 18.17.1
To Reproduce
System
Additional context
No response