Storybook addon: Module parse failed: Unexpected token
See original GitHub issueDescription
Using @chakra-ui/storybook-addon, start-storybook
doesn’t work.
Link to Reproduction
https://codesandbox.io/s/chakra-storybooks-addon-error-pfy7pn
Steps to reproduce
- Run
npm run start
to start storybook - Storybook doesn’t start and error is displayed
Chakra UI Version
2.2.6
Browser
Microsoft Edge
Operating System
- macOS
- Windows
- Linux
Additional Information
I get multiple errors of the form:
ERROR in ./node_modules/@chakra-ui/storybook-addon/dist/preset/decorators.cjs.js 87:76
Module parse failed: Unexpected token (87:76)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file.
I tried using the workaround mentioned in the docs
module.exports = {
stories: ["../src/**/*.stories.@(j|t)sx"],
addons: ["@storybook/addon-essentials", "@chakra-ui/storybook-addon"],
framework: "@storybook/react",
features: {
emotionAlias: false
},
webpackFinal: async (config) => {
config.module.rules.push({
test: /\.mjs$/,
include: /node_modules/,
type: "javascript/auto"
});
return config;
}
};
Issue Analytics
- State:
- Created a year ago
- Reactions:22
- Comments:14 (2 by maintainers)
Top Results From Across the Web
Storybook error - "ModuleParseError: Module parse failed
[built] ModuleParseError: Module parse failed: Unexpected token (6:2) You may need an appropriate loader to handle this file type, currently no ...
Read more >npm run build-storybook fails with "Module parse failed
javascript - npm run build-storybook fails with "Module parse failed: Unexpected token (20:25)" - Stack Overflow. Stack Overflow for Teams – ...
Read more >Webpack - Storybook
Storybook is a frontend workshop for building UI components and pages in isolation. Thousands of teams use it for UI development, testing, and...
Read more >“You may need an appropriate loader to handle this file type”
It's a weird error and i can't figure out what is causing it. I have an app with patternfly ... Module parse failed:...
Read more >mi on Twitter: "これで動いた! https://t.co/3Pmrlb7Jsz" / Twitter
Next13 + Chakra で storybook が動かない〜動かない〜動かない〜動かない〜 ... Storybook addon: Module parse failed: Unexpected token · Issue ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Same problem for me with
"@chakra-ui/storybook-addon": "^4.0.8"
I’m using
@storybook/builder-vite
I had the same error but It is working in my environment when I use “webpack5” as the builder.
Here is the error I got.
package.json
Reference https://stackoverflow.com/questions/70595004/chakra-ui-is-not-loading-when-used-with-storybook?rq=1
https://github.com/chakra-ui/chakra-ui/issues/5977
I hope this will be helpful to someone.