-
-
Notifications
You must be signed in to change notification settings - Fork 34.1k
Closed
Labels
esmIssues and PRs related to the ECMAScript Modules implementation.Issues and PRs related to the ECMAScript Modules implementation.feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.
Description
- Version: v14.8v0
- Platform: Windows
- Subsystem:
Related: #31710
What steps will reproduce the bug?
Windows paths are interpreted as invalid file URL. In Linux and Mac, the issue can't be reproduced.
Fail
await import("D:\repositories\fastify-autoload\routes\hello.mjs")Works
await import(url.pathToFileURL("D:\repositories\fastify-autoload\routes\hello.mjs").href)Root cause
What is the expected behavior?
Interpret windows paths as valid URL paths so we can provide consistent cross-platform behaviour.
What do you see instead?
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:698:11)
at Loader.resolve (internal/modules/esm/loader.js:82:40)
at Loader.getModuleJob (internal/modules/esm/loader.js:226:28)
at Loader.import (internal/modules/esm/loader.js:161:28)
at importModuleDynamically (internal/modules/cjs/loader.js:1144:27)
at exports.importModuleDynamicallyCallback (internal/process/esm_loader.js:27:14)
at loadPlugin (D:\repositories\fastify-autoload\index.js:118:5)
at D:\repositories\fastify-autoload\index.js:28:12
at Array.map (<anonymous>)
at fastifyAutoload (D:\repositories\fastify-autoload\index.js:27:29) {
code: 'ERR_UNSUPPORTED_ESM_URL_SCHEME'
}
k-paxian, PeppeL-G, thescientist13, DVegasa, kamiyubidan and 1 more
Metadata
Metadata
Assignees
Labels
esmIssues and PRs related to the ECMAScript Modules implementation.Issues and PRs related to the ECMAScript Modules implementation.feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.