Replies: 16 comments 2 replies
-
Can you try dropping the |
Beta Was this translation helpful? Give feedback.
-
@ricmoo Hey I tried dropping browser to no avail. Have you seen anything like this before? |
Beta Was this translation helpful? Give feedback.
-
I have seen it before, but haven’t in a while. What version of rollup.js and version of ethers are you using? If you are using an older rollup, you maybe need to pass in an |
Beta Was this translation helpful? Give feedback.
-
Using the latest version of rollup. I'm new to JS / rollup where do you think I should start to debug this? |
Beta Was this translation helpful? Give feedback.
-
I've tried using some of the rollup configs in the repo which didn't work |
Beta Was this translation helpful? Give feedback.
-
I thought to add that I see this same error. Project (currently) at https://github.com/veikkoeeva/erc1155sample/ and a few ways of seeing it are running At least my case may be because Here is also a screenshot of one variation of the issue EDIT: I went over to SO ask too, at https://stackoverflow.com/questions/67728084/transforming-umd-modules-to-es-modules-in-rollupjs-the-requested-module-x-does. EDIT 2: Made further progress that may help solving this manually by patching files in There seem to be a similar case in Rollup repo at rollup/rollup#3994. |
Beta Was this translation helpful? Give feedback.
-
I'll add here that I did just a quick experiment by going to There's more links in the SO thread, but it looks to me RollupJS checks I am not sure how laborious would it be to turn the file into ES modules locally and add default exports, but maybe I try later next week. Looking quickly at packages, most are maintained by @ricmoo already or have a TS/Rollup builds that just do not provide ES builds yet. :) (As an aside, it appears to be web advocates from communities like lit.dev, open-wc etc. note to provide ES6 builds with modern code and let users to transpile if they need specific polyfills etc.) |
Beta Was this translation helpful? Give feedback.
-
Maybe related development in TS compiler: microsoft/TypeScript#44501. |
Beta Was this translation helpful? Give feedback.
-
I'm having this exact issue as well, did anyone ever come to a solution that doesnt require manual changes to the package? |
Beta Was this translation helpful? Give feedback.
-
Maybe useful to know #2203 (comment) . |
Beta Was this translation helpful? Give feedback.
-
I'm having a similar issue: [!] Error: 'default' is not exported by node_modules/js-sha3/src/sha3.js, imported by node_modules/@ethersproject/keccak256/lib.esm/index.js
https://rollupjs.org/guide/en/#error-name-is-not-exported-by-module
node_modules/@ethersproject/keccak256/lib.esm/index.js (2:7)
1: "use strict";
2: import sha3 from "js-sha3";
^
3: import { arrayify } from "@ethersproject/bytes";
4: export function keccak256(data) {
Error: 'default' is not exported by node_modules/js-sha3/src/sha3.js, imported by node_modules/@ethersproject/keccak256/lib.esm/index.js
at error (node_modules/rollup/dist/shared/rollup.js:158:30)
at Module.error (node_modules/rollup/dist/shared/rollup.js:12423:16)
at Module.traceVariable (node_modules/rollup/dist/shared/rollup.js:12808:29)
at ModuleScope.findVariable (node_modules/rollup/dist/shared/rollup.js:11588:39)
at FunctionScope.findVariable (node_modules/rollup/dist/shared/rollup.js:6953:38)
at ChildScope.findVariable (node_modules/rollup/dist/shared/rollup.js:6953:38)
at MemberExpression.bind (node_modules/rollup/dist/shared/rollup.js:9181:49)
at CallExpression.bind (node_modules/rollup/dist/shared/rollup.js:5076:23)
at CallExpression.bind (node_modules/rollup/dist/shared/rollup.js:9425:15)
at BinaryExpression.bind (node_modules/rollup/dist/shared/rollup.js:5076:23) @veikkoeeva @samsends did you find any workaround ? @ricmoo I tried a bunch of ideas I found out there without any luck, like
|
Beta Was this translation helpful? Give feedback.
-
@syffs Only the one I noted in Vite issue forums to set up a patch-package to automate the quick fix I did manually and apply it to all these problems. It may be someone has done it already. It may be possible to refactor bn.js so Rollup understands to transform it to ESM or refactor it to support ESM altogether. I indeed read from discussion that version 6 would fix this issue one way or another. I do not know if there is a plan to gather around people to test and/or help to expedite version 6 release to fix this. <edit: One option is probably also compile and import ethers related parts as "umd" module using Rollup. With a very quick five seconds search engine something like https://remarkablemark.org/blog/2019/07/12/rollup-commonjs-umd/, i.e. a separate entry to generate an Etherjs bundle and then importing it with something like https://stackoverflow.com/questions/51461723/import-umd-javascript-modules-into-browser. In fact I may try to do that within a month if no one else does (just so busy atm :D). |
Beta Was this translation helpful? Give feedback.
-
Once the beta of v6 is out, I would love wools to experiment with various bundlers. I personally only use rollup (you can check out the various rollup configs in the project for some ideas if you are having problems) and webpack as part of the ReactNative tests. |
Beta Was this translation helpful? Give feedback.
-
Are there any other known workarounds around this issue aka building ethers through rollup? |
Beta Was this translation helpful? Give feedback.
-
Same here, has anyone been able to make this work?
|
Beta Was this translation helpful? Give feedback.
-
I'm using Svelte+Vite and somehow got it working (for now...) My
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I am struggling to get ethers.js to work with rollup.
The specific error that I am encountering in browser is:
Here is a repo to reproduce the error: https://github.com/GradientCap/Graph
Rollup config: https://github.com/GradientCap/Graph/blob/main/rollup.config.js
I've tried setting mainfields and using the commonjs plugin configuration from the ethers repo to no avail.
Any help would be appreciated.
Beta Was this translation helpful? Give feedback.
All reactions