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
🔥 Provide esm version #214
Comments
Hi @apertureless thanks for reporting and for using js-joda. I absolutely agree, it would be great to have es module section. I pushed a first draft on a branch Unfortunately the code in that branch with the es module breaks the webpack 3 build of a project depending on js-joda with a strange error message. So we still have to investigate in this issue, if you find some obvious problem in the branch please let us know. |
Short update: |
Cool. Sorry for the late reply. Somehow did not get a notification. I will provide a PR later. ✋ |
Finally its there. js-joda has now a pkg.module section with an esm build. Beside your PR there where some more things to fix: like a node style module.exports in the code and a special babel config for the node test runner. I took the opportunity and switched also all other builds to rollup. Just the karma tests are still running with webpack and waiting for migration. Thx a lot for your hints again. I will close the issue. Please feel free to reopen it again, if there are some issues left. |
🙏 Feature Request
Hey, thanks a lot for this lib.
However I think it would be really awesome, if you could provide an
esm
build, too.The reason is quite simple. Your source looks very clean and modern. And is using
import
andexport
. So imo this makes it perfect for tree shaking.🕔 Current State
Right now if I am importing
the whole
js-joda
lib will end up in my bundle. Because tree shaking is not working.This is because you're providing only a
umd
build. Which is awesome if you're using it in the browser. However tree shaking is not working in this build.💉 Fix
Should be quite simple to add a rollup config to output an ES module and in package.json just add the target in the
module
andjsnext:main
fieldThis way modern bundlers like rollup and webpack 2+ will pickup the esm and be able to tree shake and older bundlers webpack 1, gulp or browser will pickup the
umd
version.The text was updated successfully, but these errors were encountered: