require function is used in a way in which dependencies cannot be statically extracted
See original GitHub issueI added console.log(require.ensure)
to my code and it resulted in thousands of error lines from webpack. Had to increase my tmux scrollback to 40K lines to see what happened.
[...]
WARNING in ./src/routes.js
Critical dependencies:
158:18-25 require function is used in a way in which dependencies cannot be statically extracted
@ ./src/routes.js 158:18-25
WARNING in ./src/containers/Admin/TODO.md
Module parse failed: /Users/olalonde/code/project/src/containers/Admin/TODO.md Unexpected token (1:13)
You may need an appropriate loader to handle this file type.
[...]
Not sure if it’s really a bug but would have been nice if that message had been isolated from all the subsequent thousands of error lines that are really irrelevant.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:5
- Comments:30 (6 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.
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
Error message: Critical dependency : require function is used in a way in which dependencies cannot be statically extracted.
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 Free
Top 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
This is fixed in webpack@2
In case anyone else comes across this - I got this error because I was using
"module": "umd"
in mytsconfig.json
. The solution was to use"module": "commonjs"
instead - you can still get umd output by usinglibraryTarget: "umd"
inwebpack.config.js
.