Skip to content
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

Make code splitting for CJS optional instead of dropping #408

Closed
antfu opened this issue Sep 16, 2021 · 2 comments
Closed

Make code splitting for CJS optional instead of dropping #408

antfu opened this issue Sep 16, 2021 · 2 comments
Labels

Comments

@antfu
Copy link
Contributor

antfu commented Sep 16, 2021

I have been using tsup for almost all my projects during the past year. I really enjoy the DX and minimal configuration it offers. Thanks so much for this awesome project.

However, the dropping of code splitting for CJS in v5.0 via #403, could be a huge obstacle to me. Giving that the ecosystem is still quite far from taking ESM-only packages, shipping CJS along with ESM seems to be a good transition approach (and this is one of the sweet points of tsup). It could be a common practice to expose some submodules we some reusable logic with the main package, for example, https://github.com/antfu/unplugin-icons/blob/main/src/vite.ts, the lack of CJS code-splitting make all submodules contain the full package content, which will not only make the usage costly but also break functionalities like internal sharing variables.

I do understand the limitation of CJS code-splitting and the reason for dropping it, but I hope this could be somehow delayed by making it disabled by default but able to opt-in optionally. Until the ecosystem catches up, or esbuild implements the naive code-splitting for CJS.

Thanks.

@egoist egoist closed this as completed in 1667fd2 Sep 16, 2021
@github-actions
Copy link

🎉 This issue has been resolved in version 5.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@egoist
Copy link
Owner

egoist commented Sep 16, 2021

You can re-enable it by passing the --splitting flag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants