Skip to content

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

Closed
@dennisat

Description

@dennisat

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions