-
-
Notifications
You must be signed in to change notification settings - Fork 34k
Open
Description
Version
v25.2.1
Platform
Darwin Kevins-MacBook-Pro.local 25.1.0 Darwin Kernel Version 25.1.0: Mon Oct 20 19:32:41 PDT 2025; root:xnu-12377.41.6~2/RELEASE_ARM64_T6000 arm64
Subsystem
No response
What steps will reproduce the bug?
Reproduction: https://github.com/sxzz/node-loader-require-esm
How often does it reproduce? Is there a required condition?
N/A
What is the expected behavior? Why is that the expected behavior?
Expected: The parentURL of require(esm) should include the query ?test, matching the value of import.meta.url.
{
specifier: './esm.mjs',
url: 'file:///x/node-loader-require-esm/esm.mjs',
parent: 'file:///x/node-loader-require-esm/mod.mjs?test'
}
Actual:
{
specifier: './esm.mjs',
url: 'file:///x/node-loader-require-esm/esm.mjs',
parent: 'file:///x/node-loader-require-esm/mod.mjs'
}
What do you see instead?
{
specifier: './mod.mjs?test',
url: 'file:///Users/kevin/Developer/reproduction/node-loader-require-esm/mod.mjs?test',
parent: 'file:///Users/kevin/Developer/reproduction/node-loader-require-esm/main.mjs'
}
{
specifier: 'node:module',
url: 'node:module',
parent: 'file:///Users/kevin/Developer/reproduction/node-loader-require-esm/mod.mjs?test' // ✅
}
{
'import.meta.url': 'file:///Users/kevin/Developer/reproduction/node-loader-require-esm/mod.mjs?test'
}
{
specifier: './esm.mjs',
url: 'file:///Users/kevin/Developer/reproduction/node-loader-require-esm/esm.mjs',
parent: 'file:///Users/kevin/Developer/reproduction/node-loader-require-esm/mod.mjs' // ❌
}
Additional information
https://github.com/sxzz/import-without-cache needs this behavior.
/cc @joyeecheung
Metadata
Metadata
Assignees
Labels
No labels