-
Notifications
You must be signed in to change notification settings - Fork 6
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
Support TypeScript import type
#5
Comments
The program is not modifying import type because those import are supposed to be removed when transpiled into js file. Is it the case that, your transpiler / bundler is preserving the import type statements in the output? |
Running with bare bones, vanilla typescript compiler:
tsconfig.json {
"compilerOptions": {
"strict": true,
"target": "ESNext",
"module": "NodeNext",
"moduleResolution": "nodenext"
}
} build command tsc Which will throw for all non-types imports (fixed by this package), but will still throw for type-imports:
|
I'm working on I'm thinking what should the default behavior be. It seems easier to process them by default, and only preserve them as is if the project is not affected by this issue and want to minimize "git changes" |
Wonderful, thanks a lot ✨ |
The patch is released in v1.4.0 🎉 |
Wow, that was fast, thanks a bunch - works great! 🙏 |
maybe u can change to |
Hey @beenotung
Thanks a lot, creating this tool
When using
NodeNext
import type
imports also need to resolve in.js
extensions, otherwise ts compiler will throw:I see that these are currently ignored in the script via:
fix-esm-import-path/fix-esm-import-path.js
Line 210 in aa831df
When I am removing this line, they are fixed as well.
Am I missing something, why we don't want to replace those as well by default?
In this case, we could maybe expose a CLI option to include/exclude those imports, if this makes sense to you?
🙌
The text was updated successfully, but these errors were encountered: