On Webpack and CRA build there is an WARN "Critical dependency: the request of a dependency is an expression"
See original GitHub issueNote: for support questions, please use one of these channels: stackoverflow or slack
You want to:
- report a sort of bug
- request a feature
Current behaviour
When the webpack is trying to put the engine.io in a bundle, we get an optimization warning due to an expression in require() of the engine.io library.
Webpack tries to resolve required calls statically to make a minimal bundle. Your library in node_modules/engine.io/lib/server.js file and at line 80 it doing this:
this.opts.wsEngine === "ws" ? require("ws") : require(this.opts.wsEngine);
The last require() has an expression as argument.
Can we rid of this warn?
Steps to reproduce (if the current behaviour is a bug)
- Add the engine.io into a project with a webpack builder.
- Build the app to make a bundle that has the engine.io.
Expected behaviour
- No Webpack warning: “Critical dependency: the request of a dependency is an expression”
Setup
- OS: macOs
- browser: node v12.19
- engine.io version: 4.0.1
Other information (e.g. stacktraces, related issues, suggestions how to fix)
The warning:
WARNING in ./node_modules/engine.io/lib/server.js 74:67-94
Critical dependency: the request of a dependency is an expression
@ ./node_modules/engine.io/lib/engine.io.js
@ ... the node app ...
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Webpack - Critical dependency: the request of a dependency ...
Solved with npm install request@2.79.0 --save. According to the authors of ajv , the issue will likely be resolved in the latest version...
Read more >the request of a dependency is an expression - You.com
Building on v.1.2.1 using create-react-app fails due to webpack warning /node_modules/web3-eth-accounts/src/scrypt.js Critical dependency: the request of a ...
Read more >Typescript client (v1.0.49) breaks webpack build
Webpack does emit a warning, however: WARNING in ./node_modules/@servicestack/client/dist/index.js 24:51-58 Critical dependency: require ...
Read more >react-app-rewired - npm
Tweak the create-react-app webpack config(s) without using 'eject' and without creating a fork of the react-scripts. Latest version: 2.2.1, ...
Read more >Complete Guide to Webpack Configuration for React
Although there are project starters such as Create React App, ... To use these dependencies inside our webpack configuration we'll need to ...
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
That makes sense 👍 let’s schedule this for v5 then.
Fixed by https://github.com/socketio/engine.io/commit/edb734316f143bf0f1bbc344e966d18e2676b934 and included in
engine.io@5.0.0
.