-
-
Notifications
You must be signed in to change notification settings - Fork 207
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
[Feature Request] add .mjs
extension to esm output
#1058
Comments
When I use tsup to build ESM I find myself grabbing for workarounds to even load (let alone run) the built ESM code, such as https://github.com/barhun/extensionless But as a lib maintainer I can't proxy this burden to my clients, and a better workaround for me would be to patch the esm output in a postprocess somehow. But ideally tsup esm code should "just work" and no workaround should be necessary, and this issue describes exactly the behaviour I am expecting from tsup to give me for free: Correct ESM output as per the spec. |
In the meantime, take a look at this repo - it is a great workaround for this issue! 🎉 https://github.com/favware/esbuild-plugin-file-path-extensions?tab=readme-ov-file#description It provides an esbuild plugin that adds |
It might be helpful:
An example here: https://github.com/belgattitude/httpx/blob/69af14514d89b7660a6f3e5e0e4494b7f4809532/packages/exception/tsup.config.mjs#L19
i tend to use the same esbuild plugin mentioned by @klippx in conjunction with outExtension. An example here: Hope it helps, till mjs becomes default. btw thx for tsup it’s really great |
files:
config:
according to the esm spec, file extensions are mandatory
Upvote & Fund
The text was updated successfully, but these errors were encountered: