Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use swc for runtime bundling (#55842)
This swaps the existing minifier for the Next.js runtime bundling from [terser](https://github.com/terser/terser) over to [swc](https://swc.rs/docs/configuration/minification). This small change has slightly decreased development file sizes, and dramatically decreased the time it takes to bundle the runtime. The results below were ran once on my MacBook Pro (M1 Pro). ## Compilation Speed About 3 times faster - `next_bundle_pages_dev`: improved from 7.28s to 1.85s. - `next_bundle_pages_turbo`: improved from 7.28s to 1.85s. - `next_bundle_pages_prod`: improved from 7.28s to 1.93s. - `next_bundle_server`: improved from 7.28s to 2.68s. - `next_bundle_app_turbo`: improved from 8.09s to 2.89s. - `next_bundle_app_turbo_experimental`: improved from 7.74s to 2.77s. - `next_bundle_app_prod`: improved from 7.86s to 2.77s. - `next_bundle_app_dev`: improved from 9.41s to 2.86s. - `next_bundle_app_prod_experimental`: improved from 8.01s to 3.12s. - `next_bundle_app_dev_experimental`: improved from 9.11s to 3.58s. - `next_bundle`: improved from 9.50s to 3.69s. ## File Sizes About the same, small improvements in development bundle sizes ```shell # Using terser 692K packages/next/dist/compiled/next-server/app-page-experimental.runtime.dev.js 460K packages/next/dist/compiled/next-server/app-page-experimental.runtime.prod.js 460K packages/next/dist/compiled/next-server/app-page-turbo-experimental.runtime.prod.js 436K packages/next/dist/compiled/next-server/app-page-turbo.runtime.prod.js 672K packages/next/dist/compiled/next-server/app-page.runtime.dev.js 436K packages/next/dist/compiled/next-server/app-page.runtime.prod.js 68K packages/next/dist/compiled/next-server/app-route-experimental.runtime.dev.js 48K packages/next/dist/compiled/next-server/app-route-experimental.runtime.prod.js 48K packages/next/dist/compiled/next-server/app-route-turbo-experimental.runtime.prod.js 48K packages/next/dist/compiled/next-server/app-route-turbo.runtime.prod.js 68K packages/next/dist/compiled/next-server/app-route.runtime.dev.js 48K packages/next/dist/compiled/next-server/app-route.runtime.prod.js 28K packages/next/dist/compiled/next-server/pages-api-turbo.runtime.prod.js 28K packages/next/dist/compiled/next-server/pages-api.runtime.dev.js 28K packages/next/dist/compiled/next-server/pages-api.runtime.prod.js 64K packages/next/dist/compiled/next-server/pages-turbo.runtime.prod.js 68K packages/next/dist/compiled/next-server/pages.runtime.dev.js 64K packages/next/dist/compiled/next-server/pages.runtime.prod.js 204K packages/next/dist/compiled/next-server/server.runtime.prod.js # Using swc 684K packages/next/dist/compiled/next-server/app-page-experimental.runtime.dev.js 460K packages/next/dist/compiled/next-server/app-page-experimental.runtime.prod.js 460K packages/next/dist/compiled/next-server/app-page-turbo-experimental.runtime.prod.js 436K packages/next/dist/compiled/next-server/app-page-turbo.runtime.prod.js 660K packages/next/dist/compiled/next-server/app-page.runtime.dev.js 436K packages/next/dist/compiled/next-server/app-page.runtime.prod.js 68K packages/next/dist/compiled/next-server/app-route-experimental.runtime.dev.js 48K packages/next/dist/compiled/next-server/app-route-experimental.runtime.prod.js 48K packages/next/dist/compiled/next-server/app-route-turbo-experimental.runtime.prod.js 48K packages/next/dist/compiled/next-server/app-route-turbo.runtime.prod.js 68K packages/next/dist/compiled/next-server/app-route.runtime.dev.js 48K packages/next/dist/compiled/next-server/app-route.runtime.prod.js 28K packages/next/dist/compiled/next-server/pages-api-turbo.runtime.prod.js 28K packages/next/dist/compiled/next-server/pages-api.runtime.dev.js 28K packages/next/dist/compiled/next-server/pages-api.runtime.prod.js 64K packages/next/dist/compiled/next-server/pages-turbo.runtime.prod.js 68K packages/next/dist/compiled/next-server/pages.runtime.dev.js 64K packages/next/dist/compiled/next-server/pages.runtime.prod.js 204K packages/next/dist/compiled/next-server/server.runtime.prod.js ```
- Loading branch information