-
Notifications
You must be signed in to change notification settings - Fork 68
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
Add support of .mts and .cts extension as a variant of .ts files. #161
Add support of .mts and .cts extension as a variant of .ts files. #161
Comments
What is your usecase for using this extensions? Given that this prefix is not available for TSX files that are bundled with them, the module type should be decided by the bundler and not the extension |
@ArnaudBarre We have a big mono-repo with vite + vitest. The problem that we encountered is that Vitest with this plugin treating With babel version of this plugin it treats these files correctly, because it is not extension based. And right now as a hack we added flag to use babel for some packages that have |
But my questions is why in the first place you have this extensions in your source? Why not just TS files? |
@ArnaudBarre It was used to make clear that this is pure ESM file (while the rest of the project was transpiled to commonjs). And for some time it was recommended to use Anyway, it is a variant of |
The goal of this plugin is not to support everything possible in the other one. Reducing the scope of the plugin enable easier improvements in the future. I don't think this is good that this plugin allows people to mixup source code with different module system. While bun was able to do it, this is a mess for the rest of the ecosystem and I don't want to deal with this kind of issues. Source code in Vite should be in ESM. If you need commonjs for an eslint/postcss config or local scripts, you can use And this what happen for |
@ArnaudBarre adding 2 new extensions is not limiting improvements, it's just cover what was missed before, because Why it's useful?
So adding support for |
Please use |
TypeScript supports
.mts
and.cts
files, which corresponds to.mjs
and.cts
JS extensions. Right now these files are ignored by a plugin, which brings problems with ESM modules support.The text was updated successfully, but these errors were encountered: