-
Notifications
You must be signed in to change notification settings - Fork 12.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
dynamic import from module=none of an module=es2022 via barrel reemits it as commonjs #61316
Comments
Friendly ping for triage as this blocks my migration to esmodules... |
I'm not sure if this is a bug or not, but you probably do not want to be setting module=none (clearly, you're using modules?). Consider trying settings suggested at: https://www.typescriptlang.org/docs/handbook/modules/guides/choosing-compiler-options.html |
JFYI: This is part of our browser framework. So commonJS will never work in runtime.
I have a module=none part (legacy code and public namespaced API) and the unit test is still module=none While migrating parts of my application to modules I still have the core (66000 LoC output with outfile) in namespace'd |
The issue was not related to modules at all. |
π Search Terms
module import commonjs barrel
π Version & Regression Information
β― Playground Link
https://github.com/HolgerJeromin/ts-issues/tree/ts-61316
π» Code
Folder
jsModule
with tsconfig and one module file and a barrel file:file
jsModule/jsModule.ts
file
jsModule/services.ts
jsModule/tsconfig.json
And a folder
src
withmodule=none
compile:file
src/main.ts
src/tsconfig.json
π Actual behavior
Build jsModule folder:
Results in correct
jsModule/jsModule.js
Build src folder:
Changes existing
jsModule/jsModule.js
to commonJs output:--explainFiles
shows this:π Expected behavior
The emit of commonJs is completely surprising.
Expected would be one of
src/tsconfig.json
so they should not be rebuild (but only.d.ts
files consumed) ortsconfig.json
Additional information about the issue
With my real code these folders are different VS 2022 projects and therefore have no
references
.The text was updated successfully, but these errors were encountered: