-
Notifications
You must be signed in to change notification settings - Fork 130
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
[RFC] Use rollup to build the code and generate CommonJS and UMD version #43
base: master
Are you sure you want to change the base?
Conversation
bf6c71f
to
911d739
Compare
0324e13
to
e9617c7
Compare
I've been playing grave digger and updated this PR to account for the refactoring since. They actually made this significantly easier as the new structure is much better suited for rollup. Please let me know what you think. |
Thanks @realityking, I'll have a look at it. |
@realityking your PR is looking great, thanks for your work on it. However, I don't like the fact that building the module is now mandatory, besides injecting the charmap. Lets keep it open for now, keeping it up to date will be very easy. |
5551cf8
to
76482da
Compare
I pushed this a little further by also adding an ESM build. |
f3be5ad
to
7a4713d
Compare
cb00c63
to
83aba67
Compare
Rebased this (ancient) PR onto current master. The only other change is adding a The rollup version is ancient as it's the last one to support Node.js 8. CI would have to move to 14+ or better 18+ for newer versions. Happy to flesh this out into full ESM support if you're ok with the approach @simov @stscoundrel |
This is probably quite a bit to swallow, so quick overview what this PR does:
build.js
with rollup.package.json
to specific the CommonJS file asmain
The benefit of all this trouble are bundle size and easier static analysis for IDEs and other tools. The UMD version is 40 bytes smaller when minified with UglifyJS (~1%), the new CommonJS version is even 238 bytes smaller (~4.2%). Static analysis for IDEs and tools like rollup becomes easier because they generally can't figure out what's exported by an UMD module.
It's also a good step towards ESM support but that will require a bit more work.
What do you think?