Skip to content

Dynamic import of unpkg failed: Error [ERR_UNSUPPORTED_ESM_URL_SCHEME] #59189

@ahaoboy

Description

@ahaoboy

Version

node -v v24.4.1

Platform

Microsoft Windows NT 10.0.26200.0 x64

Subsystem

No response

What steps will reproduce the bug?

import("https://unpkg.com/fib-wasm-pack-inline@0.1.0/dist/index.js")
  .then(({ fib }) => {
    for (let i = 0; i < 10; i++) {
      console.log(fib(i))
    }
  })

// deno run ./test.js

// node 18 works fine
// node --experimental-network-imports ./test.js

// node 24 throw error
// node  ./test.js

How often does it reproduce? Is there a required condition?

Always throw error

What is the expected behavior? Why is that the expected behavior?

No error

What do you see instead?

node:internal/modules/esm/load:46
    throw new ERR_UNSUPPORTED_ESM_URL_SCHEME(url, supportedSchemes);
          ^

Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file and data are supported by the default ESM loader. Received protocol 'https:'
    at getSourceSync (node:internal/modules/esm/load:46:11)
    at defaultLoad (node:internal/modules/esm/load:88:34)
    at ModuleLoader.load (node:internal/modules/esm/loader:821:12)
    at ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:592:43)
    at #createModuleJob (node:internal/modules/esm/loader:617:36)
    at #getJobFromResolveResult (node:internal/modules/esm/loader:345:34)
    at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:310:41)
    at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:659:25) {
  code: 'ERR_UNSUPPORTED_ESM_URL_SCHEME'
}

Node.js v24.4.1

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions