Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ES Module loading with abolute path fails on windows #31710

Closed
Labels
esmIssues and PRs related to the ECMAScript Modules implementation.
@jonerer

Description

@jonerer
  • Version: v13.8.0
  • Platform: Windows 10 64-bit version 1809
  • Subsystem: "esm" maybe?

What steps will reproduce the bug?

  1. Create a new project inC:\prog\node\genast
  2. Add "type": "module" in package.json
  3. Make a "other.js" with some content, like
const thing = "hej"export default thing
  1. Make "index.js" with the following:
import other from "./other.js"console.log(other)
> node index.jshej

(as expected!)

  1. Change index.js to:
import other from "C:\\prog\\node\\genast\\other.js"console.log(other)

It errors out with:
internal/modules/run_main.js:54
internalBinding('errors').triggerUncaughtException(
^

Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only file and data URLs are supported by the default ESM loader
at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:33:11)
at Loader.resolve (internal/modules/esm/loader.js:85:40)
at Loader.getModuleJob (internal/modules/esm/loader.js:188:40)
at ModuleWrap. (internal/modules/esm/module_job.js:42:40)
at link (internal/modules/esm/module_job.js:41:36) {
code: 'ERR_UNSUPPORTED_ESM_URL_SCHEME'
}

Using forward- och backward slashes doesn't make a difference.

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

100%

What is the expected behavior?

Absolute includes should work the same as relative

What do you see instead?

Additional information

The same issue is seen with both static ES imports and dynamic ES imports.

Metadata

Metadata

Assignees

No one assigned

    Labels

    esmIssues and PRs related to the ECMAScript Modules implementation.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp