swcMinify
adds considerably to the bundle size in version 13.0.3
#42847
Labels
bug
Issue was opened via the bug report template.
Verify canary release
Provide environment information
Operating System:
Platform: win32
Arch: x64
Version: Windows 10 Pro
Binaries:
Node: 16.15.1
npm: N/A
Yarn: N/A
pnpm: N/A
Relevant packages:
next: 13.0.3
eslint-config-next: 13.0.3
react: 18.2.0
react-dom: 18.2.0
What browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
Describe the Bug
Short Story
When migrating from version
13.0.2
to13.0.3
, my bundle size jumped from217 KB
to253 KB
.This is a
36 KB
increase, there's clearly a problem...Long Story
I just migrated my website from
12.3.3
to13.0.3
.In
12.3.3
, I never activatedswcMinify
because it always added 2 to 4 KB to my bundle size. Sure, it was faster to build by a whole 2 seconds, but I'd take that 4 KB before the build speed.Now that
13.x
has been released,swcMinify
is the default and I activated it to see if I could finally get the same bundle size with faster builds.To my surprise, my bundle size jumped
36 KB
!!! I was already on the fence for 4 KB, 36 is simply unacceptable.I did some testing:
253 KB
As you can see, somehow activating
swcMinify
always produced higher bundle size. But version13.0.3
is simply abnormal.I ran
next-bundle-analyzer
and I saw a weird difference with version13.0.3
.While the
Stat size
values are pretty much the same across the board between13.0.2
and13.0.3
, theParsed size
andGzipped size
have huge differences.Parsed size (KB):
13.0.2
13.0.3
Gzipped size (KB):
13.0.2
13.0.3
This pattern repeats for all packages. This is where all those extra
36 KB
are coming from.I don't know what exactly changed in
swc
to have such an impact, but it seems it's not parsing the sources the same way anymore and it's producing way larger files in13.0.3
as the result.Going through the PRs for
13.0.3
, maybe one of these is the culprit:Expected Behavior
Hopefully,
swcMinify
would minify as well asbabel
did.But I'd settle with as well as it did in
13.0.2
Link to reproduction - Issues with a link to complete (but minimal) reproduction code will be addressed faster
https://github.com/TheThirdRace/thethirdrace.com.git
To Reproduce
I have a private repo I could give access to a contributor.
Just gives me a heads up in this ticket and I should give access within 12 hours.
The steps to reproduce are simple:
develop
yarn
to install dependenciesyarn build
swcMinify
is set tofalse
innext.config.js
next.config.js
to putswcMinify
in comment (default value istrue
)yarn build
The text was updated successfully, but these errors were encountered: