Skip to content

Conversation

@gribnoysup
Copy link
Collaborator

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:

  • Remove moment usage from compass-schema: usage was minimal and easy to replace with alternatives
  • Remove @lg-tools from 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 app
  • Replace tr46 dependency with a compatible polyfill: we can't fully replace the whatwg-url, but this local polyfill reduces the size noticeably

I'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

"leaflet-defaulticon-compatibility": "^0.1.1",
"leaflet-draw": "^1.0.4",
"lodash": "^4.17.21",
"moment": "^2.29.4",
Copy link
Member

Choose a reason for hiding this comment

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

❤️

@gribnoysup
Copy link
Collaborator Author

web tests are passing, so I'll merge without waiting for macos queue

@gribnoysup gribnoysup merged commit f173a4e into main Nov 6, 2024
24 of 25 checks passed
@gribnoysup gribnoysup deleted the cloudp-278538-remove-moment-lg-tools-tr46 branch November 6, 2024 15:40
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.

3 participants