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.

Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

See original GitHub issue

I have been setting up swc with webpack. There is a package I use for linting – eslint-config-react-app. This has a dependency on babel-plugin-macros. I get the following warning on starting the dev server.

Webpack version is 5.75 WARNING in ./node_modules/babel-plugin-macros/dist/index.js 75:22-29 Critical dependency: require function is used in a way in which dependencies cannot be statically extracted Looks like it is caused due to the way require is being used in this plugin. Not sure how to get rid of this warning.

  • babel-plugin-macros version: 3.1.0
  • node version: 18.12.1
  • npm version: 8.19.2

I removed all dependencies of babel and it’s related packages to avoid any potential conflicts between swc and babel but the warning is still present.

Issue Analytics

  • State:open
  • Created 9 months ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
conartist6commented, Dec 11, 2022

I don’t know, because I don’t know why it is parsing them.

1reaction
rishu605commented, Dec 11, 2022

The error message leads to this line in the code: Screenshot from 2022-12-11 22-15-21

Read more comments on GitHub >

github_iconTop 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
The error originates from the esm target, which should not have any require statements. It'd be nice to explore that built module and...
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 >
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. angularnode.jswebpack.
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 >

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