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
I am trying to use rewiremock alongside storybook to mock the behavior of some functions used by React components. Storybook uses webpack5. When trying to npm run storybook I get two errors:
First error: (http polyfill)
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "http": require.resolve("stream-http") }'
- install 'stream-http'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "http": false }
@ ./node_modules/node-libs-browser/index.js 14:21-56
@ ./node_modules/rewiremock/lib/plugins/node-lib-browser.js 16:12-40
@ ./node_modules/rewiremock/lib/plugins/index.js 51:22-51
@ ./node_modules/rewiremock/lib/index.js 16:13-39
@ ./node_modules/rewiremock/webpack.js 7:13-38
@ ./src/pages/Manage/Client/ViewClient/components/ViewClientBody/Configuration/stories/report.stories.tsx 5:0-44 12:0-10 19:4-21
@ ./src/ lazy ^\.\/.*$ include: (?%21.*node_modules)(?:\/src(?:\/(?%21\.)(?:(?:(?%21(?:^%7C\/)\.).)*?)\/%7C\/%7C$)(?%21\.)(?=.)[^/]*?\.stories\.(js%7Cjsx%7Cmjs%7Cts%7Ctsx))$ chunkName: [request] namespace object ./pages/Manage/Client/ViewClient/components/ViewClientBody/Configuration/stories/report.stories.tsx ./pages/Manage/Client/ViewClient/components/ViewClientBody/Configuration/stories/report.stories
@ ./storybook-stories.js 25:11-29:5
@ ./storybook-config-entry.js 8:0-50 20:31-39 27:0-30:2 27:56-30:1 29:27-35
I should mention I also use CRA for react. I read that I should make some configurations to my .babelrc, but is there a way to do that only for the Storybook config?
What is my configuration missing, that's causing the issue?
The text was updated successfully, but these errors were encountered:
Hello,
I am trying to use
rewiremock
alongside storybook to mock the behavior of some functions used by React components. Storybook uses webpack5. When trying tonpm run storybook
I get two errors:First error: (http polyfill)
I will attach my storybook config:
Storybook config:
I will also attach the second error:
Second error:
I should mention I also use CRA for react. I read that I should make some configurations to my
.babelrc
, but is there a way to do that only for the Storybook config?What is my configuration missing, that's causing the issue?
The text was updated successfully, but these errors were encountered: