Skip to content
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

6.4.0 breaks dynamic import from some CDNs #4077

Closed
ardislu opened this issue May 24, 2023 · 8 comments
Closed

6.4.0 breaks dynamic import from some CDNs #4077

ardislu opened this issue May 24, 2023 · 8 comments
Assignees
Labels
duplicate Duplicate of another issue. fixed/complete This Bug is fixed or Enhancement is complete and published. v6 Issues regarding v6

Comments

@ardislu
Copy link

ardislu commented May 24, 2023

Ethers Version

6.4.0

Search Terms

cdn, 6.4.0, jsdelivr

Describe the Problem

Steps to reproduce the issue:

  1. Open DevTools in a web browser.
  2. Dynamically import ethers v6.4.0 from the jsdelivr CDN:
const ethers = await import('https://cdn.jsdelivr.net/npm/[email protected]/+esm');

Expected result: ethers is imported successfully.

Actual result: the import fails when trying to import the ens-normalize dependency:

GET https://cdn.jsdelivr.net/npm/@adraffy/ens-normalize@git%2Bhttps%3A%2F%2Fgithub.com%2Fricmoo%2Fens-normalize.js.git/+esm net::ERR_ABORTED 404

Workaround:

  • Importing 6.3.0 works as expected:
const ethers = await import('https://cdn.jsdelivr.net/npm/[email protected]/+esm');
  • Importing from a different CDN, such as cdnjs, works as expected:
const ethers = await import('https://cdnjs.cloudflare.com/ajax/libs/ethers/6.4.0/ethers.js');

I believe the root cause is in 7e272a3, where package.json was updated like so:

   "dependencies": {
-    "@adraffy/ens-normalize": "1.9.0",
+    "@adraffy/ens-normalize": "https://github.com/ricmoo/ens-normalize.js",
     "@noble/hashes": "1.1.2",

Since other CDNs handle this dependency correctly, it may just be an issue with jsdelivr and nothing to do with ethers. Nonetheless, thought others may want to know in case they encounter this very specific edge case.

Code Snippet

No response

Contract ABI

No response

Errors

No response

Environment

Browser (Chrome, Safari, etc)

Environment (Other)

No response

@ardislu ardislu added investigate Under investigation and may be a bug. v6 Issues regarding v6 labels May 24, 2023
@ardislu
Copy link
Author

ardislu commented May 24, 2023

This is very similar to #4071 but in a different context. Not sure if this deserves its own issue, feel free to close this issue if it's redundant.

@ricmoo
Copy link
Member

ricmoo commented May 24, 2023

Hmmm. The CDN should be pulling in the file from the dist/?

But I’ll get these upstream changes submitted tomorrow so I can switch back to using the official package…

@pablomendezroyo
Copy link

Same issue here

@dsimog01
Copy link

Same issue when using npx:

npm verb exit 1
npm verb unfinished npm timer reify 1684840339473
npm verb unfinished npm timer reify:unpack 1684840341873
npm verb unfinished npm timer reifyNode:node_modules/@adraffy/ens-normalize 1684840341880
npm verb code 1

@ricmoo
Copy link
Member

ricmoo commented May 25, 2023

This is the same issue as #4071, I'll be keeping that issue updated instead of this one. :)

@ricmoo ricmoo added duplicate Duplicate of another issue. on-deck This Enhancement or Bug is currently being worked on. and removed investigate Under investigation and may be a bug. labels May 25, 2023
@ricmoo
Copy link
Member

ricmoo commented Jun 6, 2023

This should be fixed in v6.4.2. Can you try it out and let me know if you still have any problems?

@ricmoo ricmoo added fixed/complete This Bug is fixed or Enhancement is complete and published. and removed on-deck This Enhancement or Bug is currently being worked on. labels Jun 6, 2023
@ardislu
Copy link
Author

ardislu commented Jun 6, 2023

Thank you for the update!

I just tried this:

const ethers = await import('https://cdn.jsdelivr.net/npm/[email protected]/+esm');

And looks like it's working now. Thanks!

@ardislu ardislu closed this as completed Jun 6, 2023
@ricmoo
Copy link
Member

ricmoo commented Jun 6, 2023

Awesome! Glad to hear it! Thanks. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate Duplicate of another issue. fixed/complete This Bug is fixed or Enhancement is complete and published. v6 Issues regarding v6
Projects
None yet
Development

No branches or pull requests

4 participants