storybook: upgrade storybook to 5 fails
Describe the bug upgrade to storybook 5 fails with mysterious error
To Reproduce Steps to reproduce the behavior:
- check out https://github.com/unlock-protocol/unlock/pull/1877
- run
npm ciin the root directory cd unlock-appnpm run storybook
Expected behavior works
Screenshots
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 4
- Comments: 26 (11 by maintainers)
update: still an issue, but I found a very strange fix!
If I create a
storybook/.babelrcwhose contents is identical to the global.babelrcthen it suddenly starts working.This is still an issue with the latest everything.
As @Paskvil mentioned, the problem lies in
plugin-transform-react-constant-elementsand for me the workaround was to remove it from babel config of Storybook as it is there by default, so I did this in main.jsHope that helps anyone!
still have to do the duplicate .babelrc config workaround for storybook@^5.1.11 and styled-components@^4.3.2 that use svgs and function components
This plugin has been removed on
nextbranch. Should be released in the latest beta!@albert-schilling looks like the code still has ESM in it, which may not be supported by your browser.
I had this exact issue with “Unexpected keyword ‘var’”, triggered by adding styled-components to a create-react-app typescript project today.
Removing the
@storybook/preset-create-react-app add-onfrommain.jsand installing@storybook/preset-typescriptalong withts-loaderdid the trick.Curiously, I can’t uninstall
@storybook/preset-create-react-appfrom the package completely, as it throws “Cannot find module 'react-docgen-typescript-loader`”. I tried deleting the node_modules folder and yarn.lock, but no joy so I left it in. Still, glad it’s all working for now.Hi everyone! Seems like there hasn’t been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don’t have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!
In case anyone comes across this issue, what I found was I followed what @thecotne said above with the config, and removed all storybook addons until I found some culprits in my particular setup.
this is my workaround
i have this in my
storybook/webpack.config.jsstorybook adds some plugins in babel config which apparently causes this issue
so over writing options in babel-loader fixes issue
@mohsinulhaq I don’t think that issue is related – AFAIK that’s mostly about custom addons but this repo is only using off-the-shelf addons