Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Critical dependency warning when bundling with Webpack 5 #25

Open
Poolshark opened this issue Apr 15, 2022 · 2 comments
Open

Critical dependency warning when bundling with Webpack 5 #25

Poolshark opened this issue Apr 15, 2022 · 2 comments

Comments

@Poolshark
Copy link

Poolshark commented Apr 15, 2022

I've ran into an issue when trying to run a React application with Webpack 5. I receive the warning

WARNING in ../../../.yarn/cache/import-fresh-npm-3.3.0-3e34265ca9-2cacfad06e.zip/node_modules/import-fresh/index.js 32:31-48

Critical dependency: the request of a dependency is an expression

According to here this is caused by something like:

let var1 = someCall();
require(var1); // webpack can't determine var1 value

Here is the location in your source code which could be the problem.

https://github.com/sindresorhus/import-fresh/blob/main/index.js#L32 report there. ( not sure that this should work with webpack )

@rishu605
Copy link

I also get a similar error when bundling with webpack. I am using webpack with swc

webpack version - 5.75
node - 18.12.1

Error:
WARNING in ./node_modules/import-fresh/index.js 32:31-48 Critical dependency: the request of a dependency is an expression
For me this error is coming through packages following packages:
Screenshot from 2022-12-10 22-09-22

@markdav-hpe
Copy link

markdav-hpe commented Oct 6, 2023

+1

Import trace for requested module:
./node_modules/import-fresh/index.js
./node_modules/cosmiconfig/dist/loaders.js
./node_modules/cosmiconfig/dist/index.js
./node_modules/@databases/pg-config/lib/index.js
./node_modules/@databases/pg/lib/index.js
./src/lib/database.tsx
./src/app/page.tsx
 ⚠ ./node_modules/cosmiconfig/dist/loaders.js
Critical dependency: the request of a dependency is an expression

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants