-
Notifications
You must be signed in to change notification settings - Fork 891
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
Add es2015 modules export, build umd with rollup and remove generated code #359
Conversation
Thanks for taking this on, looks great! Regarding Is there any reason for not including the Thanks! |
@PaulLeCam thank you for your fast input on this. Regarding Concerning As far as I understand, So I am not sure it’s even needed for the commonjs build. The output seems lighter with As for the es/jsnext build, the idea is to expose the same transpiled code, without transforming the import/exports. |
So I’ve removed babel-transform-runtime as I do not believe that it is necessary (I’ll revert if you tell me otherwise). I’ve made sure that all babel configuration lies in .babelrc (umd configuration was duplicated in webpack.babel.config) – which required the webpack configuration to stop using es6 modules. And I’ve enabled scope hoisting for the umd build (that removes unnecessary closures) to lighten the umd builds. |
Whao that's great, thanks! I originally added Regarding the folders let's add With the changes to the Great job on improving the UMD builds as well! Do you think using Rollup instead of Webpack would make sense as well, or provide more benefits? |
One other thing I'm thinking could be good to improve tree shaking would be to use |
@PaulLeCam I have removed the generated code from the repository and switched the umd build to use rollup. (Yeah I thought about doing that, but thought it would be too much for this PR – I already had the rollup config lying around 😄). The rollup build is much lighter than the current build of webpack. Before, with webpack:
After, with rollup (and lodash-es):
Regarding |
Remove src out of the npm package.
6393020
to
300cfcc
Compare
Ok, I’ve cleaned up the commits and moved everything in order. To ease the review, the first commit only removes all the generated code (and updates |
Remove babel-plugin-transform-runtime from the build as it is not necessary and increases the output size for nothing.
Lightens the umd builds quite a bit: $ ll dist old dist: total 504 -rw-r--r-- 1 tusbar staff 192K Aug 16 21:16 react-leaflet.js -rw-r--r-- 1 tusbar staff 50K Aug 16 21:16 react-leaflet.min.js old: total 600 -rw-r--r-- 1 tusbar staff 263K Aug 16 21:11 react-leaflet.js -rw-r--r-- 1 tusbar staff 77K Aug 16 21:11 react-leaflet.min.js
This was taken from react-redux. :)
It looks great! |
Thank you for merging this is @PaulLeCam! Will you create a new release for it? :) |
Thanks for your PR, it's great changes! I'll probably make a new release in the next few days, I'm working on updating the types to match the changes in Flow 0.53 so when it's done it should be good to go. |
The commonjs build is kept in the repository today (
lib
). Is there any reason for that? If so, would you want the es build to be in it too?This allows to get rid of the bundled
core-js
frombabel-runtime
. And allows for rollup/webpack scope hoisting.I’m seeing a >6KB gzipped gain on etalab/inspire with this.