Skip to content

6.4.0 breaks dynamic import from some CDNs #4077

@ardislu

Description

@ardislu

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/ethers@6.4.0/+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/ethers@6.3.0/+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

Metadata

Metadata

Assignees

Labels

duplicateDuplicate of another issue.fixed/completeThis Bug is fixed or Enhancement is complete and published.v6Issues regarding v6

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions