-
Notifications
You must be signed in to change notification settings - Fork 25
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
How to disable .cjs
file generation
#91
Comments
Hi. Generated cjs is just a wrapper rather than actual build. Why would you want to remove that? |
Hi, thanks for fast reply. You're right, my version is only ~230 bytes, but if it's not needed, maybe it would be good if there was an option to disable its generation? If it's not easy to implement, I can use the mentioned alternative. This is more of a question or asking for advice, I would make a discussion, but I see that the |
We can add an option to disable. For the context, this stub makes modules compatible with Nuxt 2. And really harmless as in Nuxt 3, we natively support and pick the mjs format. |
Yep, I assumed it was for previous versions. Ok, it's not an issue or urgent, but thanks for the info. |
Hi @pi0, sorry for tagging you here, but I just updated
I ran into some possibly related discussions here (problems with type declaration and nodeResolution in TS) so I believe that's the reason for the extra files. These are The main problem is that this can increase the final version of the package a lot. I plan to switch all my modules to ESM only so that all other formats (like .cjs, .d.cts) will be unnecessary. It would be good if we could exclude them from the build, for example explicitly define which formats or extensions we want to generate. Also, why add extra |
I'd agree with @ivodolenc : it would be fantastic to have an option for "pure" ESM build, without CJS or similar. |
Assuming we're only targeting
type: module
packages, how to disablemodule.cjs
file generation in/dist
directory?I tried this but the file is still generated:
Quick alternatives
Removes it after build via package
script
:Excludes it via package
files
option:The text was updated successfully, but these errors were encountered: