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

Set babel runtime version to make smaller bundle #670

Merged
merged 1 commit into from
Mar 12, 2020
Merged

Set babel runtime version to make smaller bundle #670

merged 1 commit into from
Mar 12, 2020

Conversation

anajavi
Copy link
Contributor

@anajavi anajavi commented Feb 28, 2020

This sets used runtime version for @babel/transform-runtime.
https://babeljs.io/docs/en/babel-plugin-transform-runtime#version

It results in a smaller bundle, as transform can depend on newer features be present on runtime.

Before:

97810 react-leaflet.js
42915 react-leaflet.min.js

After:

87280 react-leaflet.js
36061 react-leaflet.min.js

By using .babelrc.js, the version could come from package.json like this:

const ENV = process.env.BABEL_ENV || process.env.NODE_ENV || 'development';
const pkg = require('./package.json');
const runtimeVersion = pkg.dependencies['@babel/runtime'];

But probably the need for version field is removed in Babel 8 anyway.

@PaulLeCam PaulLeCam merged commit c1e1ac9 into PaulLeCam:master Mar 12, 2020
@PaulLeCam
Copy link
Owner

Great idea, thanks!

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

Successfully merging this pull request may close these issues.

None yet

2 participants