-
Notifications
You must be signed in to change notification settings - Fork 5
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
separate bundle into legacy and modern bundle #828
separate bundle into legacy and modern bundle #828
Conversation
layouts/html.hbs
Outdated
@@ -85,7 +85,8 @@ | |||
}); | |||
{{/babel}} | |||
</script> | |||
<script src="{{relativePath}}/bundle.js" data-webpack-inline></script> | |||
<script src="{{relativePath}}/bundle.js" type="module" data-webpack-inline></script> | |||
<script src="{{relativePath}}/bundle-legacy.js" nomodule></script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we might need to chat with Product about this change. It has some significant upgrade implications. If somebody has forked html.hbs
, their site will stop working in IE11 if they're not careful during the upgrade. The bundle.js
asset no longer points to the same thing post-upgrade.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
talked to Rose and she gave the ok! people who overrode html.hbs will have to refresh their html.hbs anyways for the dev sdk branch change
This commit separates bundle.js into the polyfill-free bundle.js and polyfilled bundle-legacy.js. Both still run through the babel loader, because the esbuild minifier is set to target es5, and does not let you minify some bundles to es5 and some bundles to newer javascript. The type="module" and nomodule script loading pattern is used to dynamically load the correct bundle. This is the pattern we use for determining whether to use answers-modern or answers assets. J=SLAP-1373 TEST=manual see ~0.8s build speed improvements on yanswers and answers-atlanticsearch when I remove the core-js import from entry.js this build speedup doesn't show up for the test-site for some reason, though investigated for a while but could not figure out why see that the production modern bundle shrinks from 443KB to 313KB after removing polyfills smoke test that full page map on ie11 (browserstack), firefox, safari, chrome, and galaxy s6 chrome (browserstack)
c0c2214
to
f73b6a9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might mention to Rose that people who forked static/entry.js
will not see the performance benefit unless they update their fork.
Improve development build time and web performance by adding a button legacy build Create a legacy bundle build similar to #828 so that we can avoid the ponyfills and polyfills for modern web browsers. This yeids the following benefits: - Improved webpack build time by about 13% from 4.5 seconds to 4 seconds when IS_DEVELOPMENT_PREVIEW=true - Modern browsers are served a much smaller overlay-button bundle (32KB rather than the 211KB of the legacy bundle) Since specifying type="module" on the modern bundle makes it deferred, we must wait for DOMContentLoaded before trying to access `window.OverlayButtonJS` J=SLAP-1417 TEST=manual Smoke test the overlay on chrome and on IE11 on browserstack.
This commit separates bundle.js into the polyfill-free
bundle.js and polyfilled bundle-legacy.js. Both still
run through the babel loader, because the esbuild minifier
is set to target es5, and does not let you minify some
bundles to es5 and some bundles to newer javascript.
The type="module" and nomodule script loading pattern is used
to dynamically load the correct bundle. This is the pattern we
use for determining whether to use answers-modern or answers
assets. This shrinks bundle.js from 443KB to 313KB in prod mode
(and from 1.3MB to 705KB in dev mode). In prod mode the page speed
went from 50 -> 56, and in dev mode the page speed lighthouse scores
went from 36 -> 48.
J=SLAP-1373
TEST=manual
see ~0.7s build speed improvements on yanswers and answers-atlanticsearch
when I remove the core-js import from entry.js
this build speedup doesn't show up for the test-site for some reason, though
investigated for a while but could not figure out why
I figured that yanswers and another random repo would be better benchmarks, though
the test-site's build speed was also not hurt at all by this change
see that the production modern bundle shrinks from 443KB to 313KB after removing
polyfills
smoke test that full page map on ie11 (browserstack), firefox, safari, chrome, and
galaxy s6 chrome (browserstack)
see that bundle.js is inlined properly, and only the modern one is inlined