-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible discrepancy with --experimental-strip-types #54457
Labels
strip-types
Issues or PRs related to strip-types support
Comments
RedYetiDev
added
strip-types
Issues or PRs related to strip-types support
repro-exists
labels
Aug 19, 2024
// repro.mjs
await import('./imported.ts') // imported.ts
require('node:fs'); $ node --experimental-strip-types repro.mjs
(node:326497) ExperimentalWarning: Type Stripping is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
(node:326497) [MODULE_TYPELESS_PACKAGE_JSON] Warning: file:///imported.ts parsed as an ES module because module syntax was detected; to avoid the performance penalty of syntax detection, add "type": "module" to /package.json
file:///imported.ts:1
require('node:fs');
^
ReferenceError: require is not defined in ES module scope, you can use import instead
at file:///imported.ts:1:1
at ModuleJob.run (node:internal/modules/esm/module_job:262:25)
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:482:26)
at async file:///repro.mjs:1:1
Node.js v22.6.0 Also note the following warning:
If |
marco-ippolito
added a commit
to marco-ippolito/node
that referenced
this issue
Aug 26, 2024
PR-URL: nodejs#54461 Fixes: nodejs#54457 Reviewed-By: Paolo Insogna <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: Zeyu "Alex" Yang <[email protected]>
marco-ippolito
added a commit
to marco-ippolito/node
that referenced
this issue
Aug 26, 2024
PR-URL: nodejs#54461 Fixes: nodejs#54457 Reviewed-By: Paolo Insogna <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: Zeyu "Alex" Yang <[email protected]>
marco-ippolito
added a commit
to marco-ippolito/node
that referenced
this issue
Aug 31, 2024
PR-URL: nodejs#54461 Fixes: nodejs#54457 Reviewed-By: Paolo Insogna <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: Zeyu "Alex" Yang <[email protected]>
marco-ippolito
added a commit
to marco-ippolito/node
that referenced
this issue
Sep 2, 2024
PR-URL: nodejs#54461 Fixes: nodejs#54457 Reviewed-By: Paolo Insogna <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: Zeyu "Alex" Yang <[email protected]>
marco-ippolito
added a commit
to marco-ippolito/node
that referenced
this issue
Sep 12, 2024
PR-URL: nodejs#54461 Fixes: nodejs#54457 Reviewed-By: Paolo Insogna <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: Zeyu "Alex" Yang <[email protected]>
marco-ippolito
added a commit
to marco-ippolito/node
that referenced
this issue
Sep 16, 2024
PR-URL: nodejs#54461 Fixes: nodejs#54457 Reviewed-By: Paolo Insogna <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: Zeyu "Alex" Yang <[email protected]>
marco-ippolito
added a commit
to marco-ippolito/node
that referenced
this issue
Sep 16, 2024
PR-URL: nodejs#54461 Fixes: nodejs#54457 Reviewed-By: Paolo Insogna <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: Zeyu "Alex" Yang <[email protected]>
marco-ippolito
added a commit
to marco-ippolito/node
that referenced
this issue
Sep 16, 2024
PR-URL: nodejs#54461 Fixes: nodejs#54457 Reviewed-By: Paolo Insogna <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: Zeyu "Alex" Yang <[email protected]>
marco-ippolito
added a commit
to marco-ippolito/node
that referenced
this issue
Sep 17, 2024
PR-URL: nodejs#54461 Fixes: nodejs#54457 Reviewed-By: Paolo Insogna <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: Zeyu "Alex" Yang <[email protected]>
marco-ippolito
added a commit
to marco-ippolito/node
that referenced
this issue
Sep 17, 2024
PR-URL: nodejs#54461 Fixes: nodejs#54457 Reviewed-By: Paolo Insogna <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: Zeyu "Alex" Yang <[email protected]>
marco-ippolito
added a commit
that referenced
this issue
Sep 18, 2024
PR-URL: #54461 Backport-PR-URL: #54566 Fixes: #54457 Reviewed-By: Paolo Insogna <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: Zeyu "Alex" Yang <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Version
main (commit 561bc87)
Platform
Subsystem
CLI
What steps will reproduce the bug?
Create three entrypoint files:
Create two dependency files (note that these files are exactly the same, but have different file extensions):
Run all three entrypoints:
Update all three entrypoint files to import
dep.ts
instead ofdep.js
, and run the files again:How often does it reproduce? Is there a required condition?
It reproduces 100% of the time in my experience.
What is the expected behavior? Why is that the expected behavior?
I expect both scenarios to succeed because the docs state that
.ts
files have their module system determined the same way as .js files.What do you see instead?
Additional information
The error is also confusing because it says that
dep.ts
does not parse as CommonJS, even though it has the same content asdep.js
, which seems to be a CommonJS file.The text was updated successfully, but these errors were encountered: