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’m getting this warning in the console: ./node_modules/@0x/utils/node_modules/ethers/dist/ethers.min.js Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

I’m importing into my files the following:

import { Contract } from '@ethersproject/contracts';
import { Web3Provider } from '@ethersproject/providers';

I’m using Next.js.

Any idea as to why I’m getting this error?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:19 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
swene-devcommented, Sep 17, 2021

I’m getting the exact same error: ./node_modules/ethers/dist/ethers.min.js Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

while ethers is correctly installed in my project root package json.

I’m also using Next.js.

2reactions
zemsecommented, Sep 18, 2021

Can you give a code snippet of how you are importing ethers in your project?

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

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