On Windows (arm64?) custom loader stops receiving specifiers after resolving imports in an entry file #54665
Labels
arm
Issues and PRs related to the ARM platform.
duplicate
Issues and PRs that are duplicates of other issues or PRs.
loaders
Issues and PRs related to ES module loaders
strip-types
Issues or PRs related to strip-types support
windows
Issues and PRs related to the Windows platform.
Version
22.7.0
Platform
Subsystem
No response
What steps will reproduce the bug?
I was trying to run my TypeScript + node16 resolution app using
--experimental-strip-types
.To cope with
--experimental-strip-types
not working when using.js
extension in import paths, I've decided to use--import
, so this is the command I came up with:register.js
hooks.js
src/index.ts
How often does it reproduce? Is there a required condition?
100% of the time, condition: Windows (I tested arm64, can't tell if that happens on other architectures as well).
What is the expected behavior? Why is that the expected behavior?
The entire module tree to be resolved
What do you see instead?
On macOS, this works flawlessly.
On Windows, however, this does not execute start the app, custom loader stops receiving specifiers after resolving imports in an entry file, and just silently exits after producing two ExperimentalWarnings:
Additional information
Output of node --import=./register.js --experimental-strip-types ./test.js with NODE_DEBUG="*" env
PS C:\server> node --import=./register.js --experimental-strip-types ./src/index.ts (node:35372) ExperimentalWarning: Type Stripping is an experimental feature and might change at any time (Use `node --trace-warnings ...` to show where the warning was created) ESM 35372: Storing file:///C:/server/register.js (implicit type) in ModuleLoadMap ESM 35372: async addJobsToDependencyGraph() file:///C:/server/register.js ModuleJob { importAttributes: [Object: null prototype] {}, isMain: false, inspectBrk: false, url: 'file:///C:/server/register.js', module: Promise { }, modulePromise: Promise { }, linked: Promise { }, instantiated: undefined } ESM 35372: Translating StandardModule file:///C:/server/register.js ESM 35372: Storing node:module (implicit type) in ModuleLoadMap ESM 35372: async link() file:///C:/server/register.js -> node:module ModuleJob { importAttributes: [Object: null prototype] {}, isMain: false, inspectBrk: false, url: 'node:module', module: Promise { }, modulePromise: Promise { }, linked: Promise { }, instantiated: undefined } ESM 35372: Translating BuiltinModule node:module MODULE 35372: load built-in module node:module ESM 35372: Loading BuiltinModule node:module ESM 35372: async addJobsToDependencyGraph() file:///C:/server/register.js ModuleJob { importAttributes: [Object: null prototype] {}, isMain: false, inspectBrk: false, url: 'node:module', module: ModuleWrap { url: 'node:module' }, modulePromise: Promise { ModuleWrap { url: 'node:module' } }, linked: Promise { [Array(0): null prototype] [] }, instantiated: undefined } WORKER 35372: [0] create new worker internal/modules/esm/worker { stderr: false, stdin: false, stdout: false, trackUnmanagedFds: false, workerData: { lock: SharedArrayBuffer { [Uint8Contents]: <00 00 00 00>, byteLength: 4 } } } isInternal: true WORKER 35372: instantiating Worker. url: node:internal/modules/esm/worker doEval: internal WORKER 35372: [0] created Worker with ID 1 STREAM 35372: pipe count=1 opts=undefined STREAM 35372: resume STREAM 35372: pipe count=1 opts=undefined STREAM 35372: resume ESM 35372: wait for signal from worker ESM 35372: post sync message to worker { method: 'register', args: [ './hooks.js', 'file:///C:/server/register.js', undefined, undefined ], transferList: undefined } ESM 35372: wait for sync response from worker { method: 'register', args: [ './hooks.js', 'file:///C:/server/register.js', undefined, undefined ] } ESM 35372: wait for sync response from worker { method: 'register', args: [ './hooks.js', 'file:///C:/server/register.js', undefined, undefined ] } ESM 35372: got sync response from worker { method: 'register', args: [ './hooks.js', 'file:///C:/server/register.js', undefined, undefined ] } ESM 35372: post async message to worker { method: 'resolve', args: [ 'file:///C:/server/src/index.ts', undefined, [Object: null prototype] {} ], transferList: undefined } ESM 35372: wait for async response from worker { method: 'resolve', args: [ 'file:///C:/server/src/index.ts', undefined, [Object: null prototype] {} ] } ESM 35372: wait for async response from worker { method: 'resolve', args: [ 'file:///C:/server/src/index.ts', undefined, [Object: null prototype] {} ] } STREAM 35372: resume false STREAM 35372: read 0 STREAM 35372: need readable false STREAM 35372: length less than watermark true STREAM 35372: do read STREAM 35372: flow STREAM 35372: read undefined STREAM 35372: need readable true STREAM 35372: length less than watermark true STREAM 35372: reading, ended or constructing false STREAM 35372: resume false STREAM 35372: read 0 STREAM 35372: need readable false STREAM 35372: length less than watermark true STREAM 35372: do read STREAM 35372: flow STREAM 35372: read undefined STREAM 35372: need readable true STREAM 35372: length less than watermark true STREAM 35372: reading, ended or constructing false STREAM 35372: push WORKER 35372: [1] is setting up worker child environment
STREAM 35372: ondata
WORKER 35372: [1] is setting up worker child environment
STREAM 35372: dest.write true
STREAM 35372: maybeReadMore read 0
STREAM 35372: read 0
STREAM 35372: need readable true
STREAM 35372: length less than watermark true
STREAM 35372: do read
STREAM 35372: push STREAM 35372: push null
STREAM 35372: ondata
STREAM 35372: push null
STREAM 35372: dest.write true
STREAM 35372: push STREAM 35372: onEofChunk
STREAM 35372: ondata
STREAM 35372: onEofChunk
STREAM 35372: dest.write true
STREAM 35372: push STREAM 35372: emitReadable
STREAM 35372: ondata
STREAM 35372: emitReadable
STREAM 35372: dest.write true
STREAM 35372: push STREAM 35372: emitReadable false
STREAM 35372: ondata
STREAM 35372: emitReadable false
STREAM 35372: dest.write true
STREAM 35372: push WORKER 35372: [1] starts worker script internal/modules/esm/worker (eval = internal) at cwd = C:\server
STREAM 35372: ondata
WORKER 35372: [1] starts worker script internal/modules/esm/worker (eval = internal) at cwd = C:\server
STREAM 35372: dest.write true
STREAM 35372: push (node:35372) ExperimentalWarning: Type Stripping is an experimental feature and might change at any time
(Use
node --trace-warnings ...
to show where the warning was created)STREAM 35372: ondata
(node:35372) ExperimentalWarning: Type Stripping is an experimental feature and might change at any time
(Use
node --trace-warnings ...
to show where the warning was created)STREAM 35372: dest.write true
STREAM 35372: push STREAM 35372: emitReadable_
STREAM 35372: ondata
STREAM 35372: emitReadable_
STREAM 35372: dest.write true
STREAM 35372: push STREAM 35372: flow
STREAM 35372: ondata
STREAM 35372: flow
STREAM 35372: dest.write true
STREAM 35372: push ESM 35372: Storing file:///C:/server/hooks.js (implicit type) in ModuleLoadMap
STREAM 35372: ondata
ESM 35372: Storing file:///C:/server/hooks.js (implicit type) in ModuleLoadMap
STREAM 35372: dest.write true
STREAM 35372: push ESM 35372: async addJobsToDependencyGraph() file:///C:/server/hooks.js ModuleJob {
importAttributes: [Object: null prototype] {},
isMain: false,
inspectBrk: false,
url: 'file:///C:/server/hooks.js',
module: Promise { },
modulePromise: Promise { },
linked: Promise { },
instantiated: undefined
}
STREAM 35372: ondata
ESM 35372: async addJobsToDependencyGraph() file:///C:/server/hooks.js ModuleJob {
importAttributes: [Object: null prototype] {},
isMain: false,
inspectBrk: false,
url: 'file:///C:/server/hooks.js',
module: Promise { },
modulePromise: Promise { },
linked: Promise { },
instantiated: undefined
}
STREAM 35372: dest.write true
STREAM 35372: push ESM 35372: Translating StandardModule file:///C:/server/hooks.js
STREAM 35372: ondata
ESM 35372: Translating StandardModule file:///C:/server/hooks.js
STREAM 35372: dest.write true
STREAM 35372: push ESM 35372: Storing node:path (implicit type) in ModuleLoadMap
STREAM 35372: ondata
ESM 35372: Storing node:path (implicit type) in ModuleLoadMap
STREAM 35372: dest.write true
STREAM 35372: push ESM 35372: async link() file:///C:/server/hooks.js -> node:path ModuleJob {
importAttributes: [Object: null prototype] {},
isMain: false,
inspectBrk: false,
url: 'node:path',
module: Promise { },
modulePromise: Promise { },
linked: Promise { },
instantiated: undefined
}
STREAM 35372: ondata
ESM 35372: async link() file:///C:/server/hooks.js -> node:path ModuleJob {
importAttributes: [Object: null prototype] {},
isMain: false,
inspectBrk: false,
url: 'node:path',
module: Promise { },
modulePromise: Promise { },
linked: Promise { },
instantiated: undefined
}
STREAM 35372: dest.write true
STREAM 35372: push ESM 35372: Translating BuiltinModule node:path
STREAM 35372: ondata
ESM 35372: Translating BuiltinModule node:path
STREAM 35372: dest.write true
STREAM 35372: push MODULE 35372: load built-in module node:path
STREAM 35372: ondata
MODULE 35372: load built-in module node:path
STREAM 35372: dest.write true
STREAM 35372: push ESM 35372: Loading BuiltinModule node:path
STREAM 35372: ondata
ESM 35372: Loading BuiltinModule node:path
STREAM 35372: dest.write true
STREAM 35372: push ESM 35372: async addJobsToDependencyGraph() file:///C:/server/hooks.js ModuleJob {
importAttributes: [Object: null prototype] {},
isMain: false,
inspectBrk: false,
url: 'node:path',
module: ModuleWrap { url: 'node:path' },
modulePromise: Promise { ModuleWrap { url: 'node:path' } },
linked: Promise { [Array(0): null prototype] [] },
instantiated: undefined
}
STREAM 35372: ondata
ESM 35372: async addJobsToDependencyGraph() file:///C:/server/hooks.js ModuleJob {
importAttributes: [Object: null prototype] {},
isMain: false,
inspectBrk: false,
url: 'node:path',
module: ModuleWrap { url: 'node:path' },
modulePromise: Promise { ModuleWrap { url: 'node:path' } },
linked: Promise { [Array(0): null prototype] [] },
instantiated: undefined
}
STREAM 35372: dest.write true
STREAM 35372: maybeReadMore read 0
STREAM 35372: read 0
STREAM 35372: need readable true
STREAM 35372: length less than watermark true
STREAM 35372: do read
ESM 35372: got async response from worker {
method: 'resolve',
args: [
'file:///C:/server/src/index.ts',
undefined,
[Object: null prototype] {}
]
} Int32Array(1) [ 5 ]
ESM 35372: post async message to worker {
method: 'load',
args: [
'file:///C:/server/src/index.ts',
{
format: 'module-typescript',
importAttributes: [Object: null prototype] {}
}
],
transferList: undefined
}
ESM 35372: wait for async response from worker {
method: 'load',
args: [
'file:///C:/server/src/index.ts',
{
format: 'module-typescript',
importAttributes: [Object: null prototype] {}
}
]
}
ESM 35372: Storing file:///C:/server/src/index.ts (implicit type) in ModuleLoadMap
ESM 35372: async addJobsToDependencyGraph() file:///C:/server/src/index.ts ModuleJob {
importAttributes: [Object: null prototype] {},
isMain: true,
inspectBrk: false,
url: 'file:///C:/server/src/index.ts',
module: Promise { },
modulePromise: Promise { },
linked: Promise { },
instantiated: undefined
}
ESM 35372: got async response from worker {
method: 'load',
args: [
'file:///C:/server/src/index.ts',
{
format: 'module-typescript',
importAttributes: [Object: null prototype] {}
}
]
} Int32Array(1) [ 7 ]
ESM 35372: Translating TypeScript file:///C:/server/src/index.ts
ESM 35372: Translating StandardModule file:///C:/server/src/index.ts
ESM 35372: post async message to worker {
method: 'resolve',
args: [
'./app.js',
'file:///C:/server/src/index.ts',
[Object: null prototype] {}
],
transferList: undefined
}
ESM 35372: wait for async response from worker {
method: 'resolve',
args: [
'./app.js',
'file:///C:/server/src/index.ts',
[Object: null prototype] {}
]
}
ESM 35372: post async message to worker {
method: 'resolve',
args: [
'./websocket.js',
'file:///C:/server/src/index.ts',
[Object: null prototype] {}
],
transferList: undefined
}
ESM 35372: wait for async response from worker {
method: 'resolve',
args: [
'./websocket.js',
'file:///C:/server/src/index.ts',
[Object: null prototype] {}
]
}
ESM 35372: post async message to worker {
method: 'resolve',
args: [
'./env.js',
'file:///C:/server/src/index.ts',
[Object: null prototype] {}
],
transferList: undefined
}
ESM 35372: wait for async response from worker {
method: 'resolve',
args: [
'./env.js',
'file:///C:/server/src/index.ts',
[Object: null prototype] {}
]
}
ESM 35372: post async message to worker {
method: 'resolve',
args: [
'./startup/index.js',
'file:///C:/server/src/index.ts',
[Object: null prototype] {}
],
transferList: undefined
}
ESM 35372: wait for async response from worker {
method: 'resolve',
args: [
'./startup/index.js',
'file:///C:/server/src/index.ts',
[Object: null prototype] {}
]
}
ESM 35372: post async message to worker {
method: 'resolve',
args: [
'./cron/index.js',
'file:///C:/server/src/index.ts',
[Object: null prototype] {}
],
transferList: undefined
}
ESM 35372: wait for async response from worker {
method: 'resolve',
args: [
'./cron/index.js',
'file:///C:/server/src/index.ts',
[Object: null prototype] {}
]
}
ESM 35372: got async response from worker {
method: 'resolve',
args: [
'./app.js',
'file:///C:/server/src/index.ts',
[Object: null prototype] {}
]
} Int32Array(1) [ 11 ]
ESM 35372: got async response from worker {
method: 'resolve',
args: [
'./websocket.js',
'file:///C:/server/src/index.ts',
[Object: null prototype] {}
]
} Int32Array(1) [ 13 ]
ESM 35372: got async response from worker {
method: 'resolve',
args: [
'./env.js',
'file:///C:/server/src/index.ts',
[Object: null prototype] {}
]
} Int32Array(1) [ 13 ]
ESM 35372: got async response from worker {
method: 'resolve',
args: [
'./startup/index.js',
'file:///C:/server/src/index.ts',
[Object: null prototype] {}
]
} Int32Array(1) [ 15 ]
ESM 35372: got async response from worker {
method: 'resolve',
args: [
'./cron/index.js',
'file:///C:/server/src/index.ts',
[Object: null prototype] {}
]
} Int32Array(1) [ 15 ]
ESM 35372: post async message to worker {
method: 'load',
args: [
'file:///C:/server/src/app.ts',
{
format: 'module-typescript',
importAttributes: [Object: null prototype] {}
}
],
transferList: undefined
}
ESM 35372: wait for async response from worker {
method: 'load',
args: [
'file:///C:/server/src/app.ts',
{
format: 'module-typescript',
importAttributes: [Object: null prototype] {}
}
]
}
ESM 35372: Storing file:///C:/server/src/app.ts (implicit type) in ModuleLoadMap
ESM 35372: post async message to worker {
method: 'load',
args: [
'file:///C:/server/src/websocket.ts',
{
format: 'module-typescript',
importAttributes: [Object: null prototype] {}
}
],
transferList: undefined
}
ESM 35372: wait for async response from worker {
method: 'load',
args: [
'file:///C:/server/src/websocket.ts',
{
format: 'module-typescript',
importAttributes: [Object: null prototype] {}
}
]
}
ESM 35372: Storing file:///C:/server/src/websocket.ts (implicit type) in ModuleLoadMap
ESM 35372: post async message to worker {
method: 'load',
args: [
'file:///C:/server/src/env.ts',
{
format: 'module-typescript',
importAttributes: [Object: null prototype] {}
}
],
transferList: undefined
}
ESM 35372: wait for async response from worker {
method: 'load',
args: [
'file:///C:/server/src/env.ts',
{
format: 'module-typescript',
importAttributes: [Object: null prototype] {}
}
]
}
ESM 35372: Storing file:///C:/server/src/env.ts (implicit type) in ModuleLoadMap
ESM 35372: post async message to worker {
method: 'load',
args: [
'file:///C:/server/src/startup/index.ts',
{
format: 'module-typescript',
importAttributes: [Object: null prototype] {}
}
],
transferList: undefined
}
ESM 35372: wait for async response from worker {
method: 'load',
args: [
'file:///C:/server/src/startup/index.ts',
{
format: 'module-typescript',
importAttributes: [Object: null prototype] {}
}
]
}
ESM 35372: Storing file:///C:/server/src/startup/index.ts (implicit type) in ModuleLoadMap
ESM 35372: post async message to worker {
method: 'load',
args: [
'file:///C:/server/src/cron/index.ts',
{
format: 'module-typescript',
importAttributes: [Object: null prototype] {}
}
],
transferList: undefined
}
ESM 35372: wait for async response from worker {
method: 'load',
args: [
'file:///C:/server/src/cron/index.ts',
{
format: 'module-typescript',
importAttributes: [Object: null prototype] {}
}
]
}
ESM 35372: Storing file:///C:/server/src/cron/index.ts (implicit type) in ModuleLoadMap
ESM 35372: got async response from worker {
method: 'load',
args: [
'file:///C:/server/src/app.ts',
{
format: 'module-typescript',
importAttributes: [Object: null prototype] {}
}
]
} Int32Array(1) [ 22 ]
ESM 35372: async link() file:///C:/server/src/index.ts -> ./app.js ModuleJob {
importAttributes: [Object: null prototype] {},
isMain: false,
inspectBrk: false,
url: 'file:///C:/server/src/app.ts',
module: Promise { },
modulePromise: Promise { },
linked: Promise { },
instantiated: undefined
}
ESM 35372: got async response from worker {
method: 'load',
args: [
'file:///C:/server/src/websocket.ts',
{
format: 'module-typescript',
importAttributes: [Object: null prototype] {}
}
]
} Int32Array(1) [ 24 ]
ESM 35372: async link() file:///C:/server/src/index.ts -> ./websocket.js ModuleJob {
importAttributes: [Object: null prototype] {},
isMain: false,
inspectBrk: false,
url: 'file:///C:/server/src/websocket.ts',
module: Promise { },
modulePromise: Promise { },
linked: Promise { },
instantiated: undefined
}
ESM 35372: got async response from worker {
method: 'load',
args: [
'file:///C:/server/src/env.ts',
{
format: 'module-typescript',
importAttributes: [Object: null prototype] {}
}
]
} Int32Array(1) [ 24 ]
ESM 35372: async link() file:///C:/server/src/index.ts -> ./env.js ModuleJob {
importAttributes: [Object: null prototype] {},
isMain: false,
inspectBrk: false,
url: 'file:///C:/server/src/env.ts',
module: Promise { },
modulePromise: Promise { },
linked: Promise { },
instantiated: undefined
}
ESM 35372: got async response from worker {
method: 'load',
args: [
'file:///C:/server/src/startup/index.ts',
{
format: 'module-typescript',
importAttributes: [Object: null prototype] {}
}
]
} Int32Array(1) [ 24 ]
ESM 35372: async link() file:///C:/server/src/index.ts -> ./startup/index.js ModuleJob {
importAttributes: [Object: null prototype] {},
isMain: false,
inspectBrk: false,
url: 'file:///C:/server/src/startup/index.ts',
module: Promise { },
modulePromise: Promise { },
linked: Promise { },
instantiated: undefined
}
ESM 35372: got async response from worker {
method: 'load',
args: [
'file:///C:/server/src/cron/index.ts',
{
format: 'module-typescript',
importAttributes: [Object: null prototype] {}
}
]
} Int32Array(1) [ 24 ]
ESM 35372: async link() file:///C:/server/src/index.ts -> ./cron/index.js ModuleJob {
importAttributes: [Object: null prototype] {},
isMain: false,
inspectBrk: false,
url: 'file:///C:/server/src/cron/index.ts',
module: Promise { },
modulePromise: Promise { },
linked: Promise { },
instantiated: undefined
}
The text was updated successfully, but these errors were encountered: