-
Notifications
You must be signed in to change notification settings - Fork 27.6k
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
Optimisations no longer applied to _buildManifest.js
when using SWC
#31291
Comments
Okay, I found the cause. The inliner inlines strings because those are literal, which is ‘simple enough’. I'll see if google closure compiler still inlines all string. |
heyo @kdy1, @timneutkens I tested again using |
I verified that it's not fixed, and I'll fix it soon. |
swc_ecma_minifier: - Don't optimize `1 / t == -1 / 0` as `!1`. - Don't optimize `e === -1 / 0` as false. - Don't inline string literals in arguments, if it's used multiple time. (vercel/next.js#31291)
The purpose of this PR is to apply - swc-project/swc#2779 - Fixes #31291. - Not sure if it's fully fixed, but fixes some bugs related to #31391 - swc-project/swc#2818 - Fixes #31627 I'll undraft this PR once swc-project/swc#2818 is fixed.
Confirmed, LGTM on a new build with 12.0.5-canary.6 👍 |
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
The purpose of this PR is to apply - swc-project/swc#2779 - Fixes vercel#31291. - Not sure if it's fully fixed, but fixes some bugs related to vercel#31391 - swc-project/swc#2818 - Fixes vercel#31627 I'll undraft this PR once swc-project/swc#2818 is fixed.
What version of Next.js are you using?
12.0.4-canary.4
What version of Node.js are you using?
16.13.0
What browser are you using?
Chrome
What operating system are you using?
macOS
How are you deploying your application?
Vercel
Describe the Bug
After enabling SWC I noticed that
buildManfest.json
's output grew significantly (20kb⇢80kb) because it is no longer using optimisations for chunk names, e.g:self.__BUILD_MANIFEST=function(e,s,a,t,c,o,n,i,r,g,l,b,d,u,p,f,h,m,k)
Over the wire (with Gzip compression) the file size difference isn't anywhere near as dramatic (Repeated strings are of course optimised by Gzip, so they both end up around 6kb), but there may be an impact to JS parse & compile times, which could compromise main thread performance for sites with many pages.
Expected Behavior
Optimisations should be applied to
_buildManifest.js
to avoid a potential perf regression.To Reproduce
rm -rf .next
next build
.next/static/<generatedHash>/_buildManifest.js
(small)rm -rf .next
swcMinify: true
innext.config.json
next build
.next/static/<generatedHash>/_buildManifest.js
(large)The text was updated successfully, but these errors were encountered: