chore(web): reduce bundle size and add regression checks when packaging CLOUDP-278538 #6452
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The mms client code added a strict validation for webpack generated chunk sizes to make sure that they are under the infrastructure limit setup for the inflight compression they are using when serving website assets. Because of that we are currently blocked from updating compass-web in mms because new versions are above the limit. This patch takes care of some low hanging fruits to get the size back below the limit and adds a similar strict validation so that we can be sure we're maintaining the size going forward.
Following changes reduced the compressed bundle size from ~9.5mb to ~8.9mb which is enough for us to pass the check for now:
momentusage fromcompass-schema: usage was minimal and easy to replace with alternatives@lg-toolsfrom bundle through aliasing to empty module: leafygreen re-exports some test helpers through the actual component packages which causes massive blobs of test helper code to get bundled, it's safe to alias it that way as it's never used in the bundled apptr46dependency with a compatible polyfill: we can't fully replace the whatwg-url, but this local polyfill reduces the size noticeablyI'm planning to follow-up with a patch that also does some extra splitting of compass-web package into multiple chunks instead of just one
dist/index.js, but it's a less straightforward change that would require extra effort to make sure it's all wired together properly, so I'm keeping it out to make sure we can unblock ourselves quicker