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

Upgrading dependencies and switching build to all rollup #2149

Merged
merged 19 commits into from Apr 1, 2020
Merged

Conversation

joeldenning
Copy link
Collaborator

Changes:

  • Added //# sourceMappingURL comment to minified output. This accounts for some of the byte size increases.
  • Build now runs on windows without bash emulation
  • Dependencies upgraded
  • rollup-plugin-terser instead of terser cli
  • terser 4 instead of terser 3

The motivation for this change was a susbsequent change that adds error codes to reduce the bundle size further.

I haven't tested all the minified files in a browser yet, but will do so in ie, safari, ff, and chrome if this becomes ready to merge.

Before After
Gzipped s.min.js 1807 1853
Gzipped system.min.js 3532 3612
s.min.js 4538 4586
system.min.js 9699 9656
amd.min.js 1670 1710
global.min.js 787 773
module-types.min.js 1500 1553
named-exports.min.js 627 675
named-register.min.js 834 883
transform.min.js 530 578
use-default.min.js 207 253

@joeldenning joeldenning mentioned this pull request Mar 30, 2020
Copy link
Member

@guybedford guybedford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I recall correctly the main reason I didn't do this originally for the extras was because Rollup adds an extra wrapper.

It doesn't seem a very high cost though at all, so I'd be happy to land this.

We must make sure to test IE11 though before landing.

"min": "npm run min:systemjs && npm run min:sjs",
"min:systemjs": "cd dist && terser system.js -c passes=2 -m --source-map --comments \"/SystemJS \\d/\" -o system.min.js",
"min:sjs": "cd dist && terser s.js -c passes=2 -m --source-map -o s.min.js",
"build": "rimraf dist && rollup -c",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should retain a build mode / option that allows skipping minification here for quick builds in development.

I seem to recall there may even be a way with RollupJS to pass options, but can't remember if that is correct. Otherwise environment variables can work too.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can with rollup's --environment flag

if (name.__esModule) {
ns.__esModule = name.__esModule;
if (name[__esModule]) {
ns[__esModule] = name[__esModule];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't necessary because it shouldn't affect the gzip size.

* Minimal SystemJS Build
*/` : `/*
* SystemJS ${version}
*/`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation here needs to shift back two spaces.

@joeldenning
Copy link
Collaborator Author

I verified that the browser tests work in chrome, ff, safari 13, edge, and IE11, with both system.js and system.min.js.

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