Skip to content

perf: shrink wasm size by avoid importing browserslist#5204

Merged
lukastaegert merged 1 commit intorollup:masterfrom
sapphi-red:trim-wasm
Oct 15, 2023
Merged

perf: shrink wasm size by avoid importing browserslist#5204
lukastaegert merged 1 commit intorollup:masterfrom
sapphi-red:trim-wasm

Conversation

@sapphi-red
Copy link
Contributor

This PR contains:

  • bugfix
  • feature
  • refactor
  • documentation
  • other

Are tests included?

  • yes (bugfixes and features will not be merged without tests)
  • no

Breaking Changes?

  • yes (breaking changes will not be merged unless absolutely necessary)
  • no

List any relevant issue numbers:

Description

This PR reduces the wasm size by ~70% by avoid importing browserslist.

swc crate imports browserslist-rs indirectly and because browserslist-rs has #[wasm_bindgen]that function was exposed and the dependencies of that function was included in the wasm binary.

wasm: 5.20MB -> 1.54MB
node (windows): 3.32MB -> 3.31MB

@vercel
Copy link

vercel bot commented Oct 15, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
rollup ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 15, 2023 8:16am

@codecov
Copy link

codecov bot commented Oct 15, 2023

Codecov Report

Merging #5204 (552ea22) into master (ee0639e) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #5204   +/-   ##
=======================================
  Coverage   98.82%   98.82%           
=======================================
  Files         231      231           
  Lines        8849     8849           
  Branches     2314     2314           
=======================================
  Hits         8745     8745           
  Misses         43       43           
  Partials       61       61           

Copy link
Member

@lukastaegert lukastaegert left a comment

Choose a reason for hiding this comment

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

Amazing find, thanks a lot!

@lukastaegert lukastaegert added this pull request to the merge queue Oct 15, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 15, 2023
@lukastaegert lukastaegert added this pull request to the merge queue Oct 15, 2023
Merged via the queue into rollup:master with commit 51c974d Oct 15, 2023
@sapphi-red sapphi-red deleted the trim-wasm branch October 16, 2023 01:49
@github-actions
Copy link

This PR has been released as part of rollup@4.1.4. You can test it via npm install rollup.

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.

2 participants