storybook: corejs-upgrade-webpack-plugin causing problems
Describe the bug If you import fetch-mock (which relies on core-js v2), its core-js imports fail. If I hack storybook to remove the corejs-upgrade-webpack-plugin, everything seems to work fine.
Sample errors:
ERROR in ./node_modules/fetch-mock/es5/client.js
Module not found: Error: Cannot find module 'core-js/modules/es6.regexp.replace'
@ ./node_modules/fetch-mock/es5/client.js 115:0-45
@ ./src/stories/index.js
@ ./.storybook/config.js
@ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./.storybook/config.js ./node_modules/webpack-hot-middleware/client.js?reload=true
To Reproduce Steps to reproduce the behavior:
- Clone https://github.com/jdelStrother/corejs-demo (a create-react-app with storybook, and an import for fetch-mock)
- Run
yarn storybook
Expected behavior Storybook successfully builds
System:
- OS: MacOS 10.14.5
- Device: Macbook Pro 2016
- Version: 5.1.9
Additional context Fun fact: Naming your project “core-js-demo” is also a great way to break your storybook build since it matches the /core-js/ regexp that the plugin uses…
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 11
- Comments: 16 (10 by maintainers)
Commits related to this issue
- chore(storybook): remove core-js plugin from storybook config ref: https://github.com/storybookjs/storybook/issues/7445 — committed to emyarod/carbon by emyarod 5 years ago
- chore(storybook): remove core-js plugin from storybook config ref: https://github.com/storybookjs/storybook/issues/7445 — committed to emyarod/carbon by emyarod 5 years ago
- chore(storybook): remove core-js plugin from storybook config ref: https://github.com/storybookjs/storybook/issues/7445 — committed to emyarod/carbon by emyarod 5 years ago
Fun fact: this issue is the second link in Google for “corejs-upgrade-webpack-plugin”
OMG… This error was only happening on CI, and has been taking up most of my time these past 2 days…
My branch was called
issue/SG-16714-fix-core-js-dist-conflicts, which on CI gets baked into the workspace path…:🤦♂
@BridgeAR We can remove it in 6.0, I’d be happy to accept a PR on the next branch!
This happens with any module that depends on
core-js@2