Require function is used in a way in which dependencies cannot be statically extracted
See original GitHub issueHi,
Firstly thank-you for all the hard work on msw
, it really makes mocking end-points really easy. I have found that on latest Storybook (6.4.9), there’s a warning in the console:
./node_modules/msw-storybook-addon/dist/mswDecorator.js
25:45-52 Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
It is referring to this line. I have found simply commenting it out directly in my node_modules resolves the issue. Is there a reason for assigning require
to __non_webpack_require__
? Doesn’t this overwrite the point of using __non_webpack_require__
in this instance? i.e.
globalThis.__non_webpack_require__ = require
is replaced by webpack toglobalThis.__non_webpack_require__ = __webpack__require__
- Meaning the next line reads:
const { setupServer } = __webpack_require__('msw/node')
I’m going to see if I can get this repo up and running in a fork and replicate the issue…
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Critical dependency: require function is used in a way in which ...
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted · Subscribe to RSS.
Read more >Critical dependency: require function is used in a way ... - GitHub
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted #1252 · Comments · Workarounds to ...
Read more >Incompatible with Webpack - Google Groups
"require function is used in a way, in which dependencies cannot be statically extracted" These errors come when trying to "require" specific modules, ......
Read more >Critical dependency: require function is ... - Auth0 Community
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted ; samueljbarrick May 4, 2020, 10:28pm ...
Read more >Node.js – WARNING in Critical dependency: require function ...
Node.js – WARNING in Critical dependency: require function is used in a way in which dependencies cannot be statically extracted · Best Solution...
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
Sure @kettanaito, will do 👍 Thanks.
That sounds like a great approach, @will-stone. Would you like to open a pull request so we could release it?