-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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: require function is used in a way in which dependencies cannot be statically extracted #2045
Comments
This looks like an issue with the |
Do you have |
I'm getting the exact same error: while I'm also using Next.js. |
Can you give a code snippet of how you are importing ethers in your project? |
Surely, thank you for the help. I'm importing the following: import { Web3Provider } from '@ethersproject/providers'
import { formatEther } from '@ethersproject/units' And in the package.json: "@ethersproject/providers": "latest",
"@ethersproject/units": "latest", |
The issue has something to do with |
@swene-dev Does the error stay if you use the umbrella package? import { ethers } from 'ethers';
const { Web3Provider } = ethers.providers;
const { formatEther } = ethers.utils; |
@zemse Same error with this code. I have switched back to a previous version of our app and the code is not having the issue while using the parameters I cited above.. I will rebuild from this version. You can close this issue on my side, thank you for your help! |
I am having this issue. I've just installed the libs. Any one know how to solve? |
Try deleting the |
Does anyone have the solution to this error: |
Try deleting all your node_modules files, deleting yarn.lock or package.lock. Then upgrade your dependencies to a newer version, then redownloading them all again. |
I'm having the same problem. I tried all the above suggestions. Can we reopen this issue? package.json dependencies:
I tried all of these import methods, they all yield the same error:
|
Only have |
I don’t think this is a problem with ethers, is it? What tool are you trying to use? Is it coming from npm? |
I removed a bunch of extraneous dependencies, including I also deleted the You're right, it likely has nothing to do with ethers, it's just a frustrating error. Thanks for your assistance. |
Did my tip help? |
I have started getting this error after upgrading to react v18 and react-scripts v5.0.1, which uses webpack v5. I'm still using ethers v4, so maybe that is the problem? Update: yes, that was the problem. I upgraded to ethers v5 and it works now. |
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:
I'm using Next.js.
Any idea as to why I'm getting this error?
The text was updated successfully, but these errors were encountered: