-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
emit .js
extensions to produce valid ESM import/export paths
#8742
Comments
A workaround I know of is to configure `tsconfig.json' ⬇⬇⬇ {
"compilerOptions": {
"declaration": true,
"importHelpers": true,
"module": "NodeNext",
"strict": true,
"target": "ESNext",
"esModuleInterop": true,
"moduleResolution": "NodeNext"
}
}
// ======
// SOURCE
// Import from './pkgs.ts' to './ctx.ts'
// ======
import { ProjectPackages, getProjectPackages } from "~/pkgs.js";
export interface Ctx {
packages: ProjectPackages | null
}
//... ⬇ swc ⬇ import { getProjectPackages } from "./pkgs.js";
//... |
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Describe the feature
We are using swc extensively but recently ran into issues when compiling sources to native ESM output.
swc should provide an option to emit explicit extensions within imports even if they are not specified within source code.
module#resolveFully
is used it will unwrap directory import/exports to explicitly emitindex.js
Current behaviour:
⬇ swc with config ⬇
⬇⬇⬇
Expected behaviour:
⬇ swc with config ⬇
⬇⬇⬇
Related issues:
Babel plugin or link to the feature description
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: