question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

On Webpack and CRA build there is an WARN "Critical dependency: the request of a dependency is an expression"

See original GitHub issue

Note: 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:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
darrachequesnecommented, Nov 9, 2020

That makes sense 👍 let’s schedule this for v5 then.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found