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

Bundle standalone using rollup #10779

Merged

Conversation

@JLHwung
Copy link
Contributor

JLHwung commented Nov 29, 2019

Q                       A
Fixed Issues? Shrink *-standalone size
Tests Added + Pass? Nope
Documentation PR Link
Any Dependency Changes? Rollup plugins are added, webpack plugins/gulp-uglify are removed.
License MIT

This PR supersedes #7581 and is loosely based on #7581 because I find it too difficult to rebase.

This PR translates the webpack config in the language of rollup config. gulp-uglify is also replaced by rollup-plugin-terser.

Updates:
There is a fatal error on the previous size comparison table, some of the dependencies of babel-preset-env-standalone was not bundled due to the importer is not an ES Module. The new size comparison has reflected on this fix. Thanks to @nicolo-ribaudo who fist discovered this error.

Here is the size comparison between Circle CI Artifacts and *-standalone 7.7.4 (babel, env)

Previous Size New Size Change
babel.js 3.04 MB 2.6 MB -14%
babel.min.js 1.63 MB 1.2 MB -26%
babel-preset-env.js 2.93 MB 3.3 MB +13%
babel-preset-env.min.js 1.7 MB 1.3 MB -24%

The increased size in babel-preset-env.js is from the fact that rollup does not strip the comments by default. For production usage, please refer to babel-preset-env.min.js.

Here is the size comparison between [Circle CI Artifacts](https://app.circleci.com/jobs/github/babel/babel/13068) and `*-standalone` 7.7.4 ([babel](https://unpkg.com/browse/@babel/standalone@7.7.4/), [env](https://unpkg.com/browse/@babel/preset-env-standalone@7.7.4/))
Previous Size New Size Change
babel.js 3.04 MB 2.6 MB 14%
babel.min.js 1.63 MB 1.2 MB 26%
babel-preset-env.js 2.93 MB 1.0 MB 66%
babel-preset-env.min.js 1.7 MB 450 kB 74%

(It seems that buildsize does not comment for unknown reasons...)

@JLHwung JLHwung force-pushed the JLHwung:standalone-rollup-bundle-without-yarn-workspaces branch from 4e47930 to 5ba0487 Nov 29, 2019
],
sourceType: "unambiguous",
},
{

This comment has been minimized.

Copy link
@JLHwung

JLHwung Nov 30, 2019

Author Contributor

They are removed since rollup-plugin-babel can combine the helpers into a single block.

babel.config.js Outdated Show resolved Hide resolved
@nicolo-ribaudo

This comment has been minimized.

Copy link
Member

nicolo-ribaudo commented Dec 2, 2019

CircleCI is failing because of core-js 3.4.6. It's fixed in 3.4.7, but I don't know how to clear the cache before triggering a build.

@JLHwung JLHwung force-pushed the JLHwung:standalone-rollup-bundle-without-yarn-workspaces branch from eedddce to 5244a7b Dec 2, 2019
@JLHwung JLHwung merged commit a0bed42 into babel:master Dec 5, 2019
4 of 5 checks passed
4 of 5 checks passed
test262 Workflow: test262
Details
Travis CI - Pull Request Build Passed
Details
codecov/project 88.14% (target 80%)
Details
e2e Workflow: e2e
Details
test Workflow: test
Details
@JLHwung JLHwung deleted the JLHwung:standalone-rollup-bundle-without-yarn-workspaces branch Dec 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.