Runtime error with rollup
See original GitHub issueI am trying to use ethers for a browser-based app, built with rollup.
Package in package.json is:
"dependencies": {
"ethers": "^5.1.0",
...
The sample code from the doc:
import { ethers } from "ethers";
if (window["ethereum"] !== undefined) {
const provider = new ethers.providers.Web3Provider(window["ethereum"]);
const signer = provider.getSigner();
} else {
alert("no wallet");
}
builds properly but gives a runtime error in browser console:
Uncaught (in promise) TypeError: Failed to resolve module specifier "util". Relative references must start with either "/", "./", or "../".
It seems that some Node-related bits are included in the build, despite having in rollup.config.js:
resolve({
browser: true
})
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (1 by maintainers)
Top Results From Across the Web
Rollup is getting failed with The internal session was ...
To solve this error: Manually set the flag aggrexist from 'X' to ' '. Review below note for function module "RSDDTREX_AFTER_UPGRADE_70X_73X",
Read more >Rollup error: could not load a module from @babel/runtime ...
I found a workable solution. I just add the @rollup/plugin-alias plugin ... //other code const alias = require('@rollup/plugin-alias'); ...
Read more >Error during installing Nakama Typescript Server Runtime
That's why I am trying to setup Nakama typescript server runtime using ... rollup.config.js to rollup.config.mjs it now gives below error:
Read more >rollup/plugin-babel
Start using @rollup/plugin-babel in your project by running `npm i ... @babel/runtime/helpers/get ) and Rollup will only exclude modules ...
Read more >Hotfix rollup 2784931 is available for Microsoft Dynamics ...
When you try to open the Cashier list in Microsoft Dynamics RMS Store Operations Manager, you receive the following error message: Runtime Error...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

All resolved with new separate imports from 5.6
Thanks again for making this great lib!
you are right dude, but in my opinion they should fix that issue and also give an explanation why the import { ethers } from ‘ethers’ doesn’t work, in my case I got an << Uncaught TypeError: Error resolving module specifier “ethers”. Relative module specifiers must start with “./”, “…/” or “/”. >> when using the import I previously mentioned, but then importing the cdn everything works fine.