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

Support ES modules #68

Closed
egoist opened this issue Jul 18, 2020 · 4 comments
Closed

Support ES modules #68

egoist opened this issue Jul 18, 2020 · 4 comments
Labels

Comments

@egoist
Copy link
Owner

egoist commented Jul 18, 2020

Node.js has native esm support now, it makes sense to generate an additional .mjs bundle.

So by using --esm you will have two bundled files, index.js and index.mjs

@talentlessguy
Copy link

talentlessguy commented Jul 18, 2020

Will it also be possible to make it generate .js for ESM and .cjs for CJS? so we can use "type": "module"?

EDIT: as suggested, we can check for pkg.type === 'module'

@egoist
Copy link
Owner Author

egoist commented Jul 20, 2020

I've released v3.0, now it uses esbuild to bundle your code so there's currently no way to change output extension, see https://github.com/egoist/tsup#bundle-formats

@egoist egoist closed this as completed Jul 20, 2020
@egoist
Copy link
Owner Author

egoist commented Jul 21, 2020

Hope this can be resolved: evanw/esbuild#281

@egoist egoist reopened this Jul 21, 2020
@egoist egoist changed the title Add --esm flag Support ES modules Jul 21, 2020
@egoist egoist closed this as completed in 3ebef58 Jul 25, 2020
@github-actions
Copy link

🎉 This issue has been resolved in version 3.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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