Skip to content

Commit 45c36e6

Browse files
authored
1 parent c5896f2 commit 45c36e6

File tree

4 files changed

+6
-41
lines changed

4 files changed

+6
-41
lines changed

docs/advanced-features/compiler.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ description: Learn about the Next.js Compiler, written in Rust, which transforms
99

1010
| Version | Changes |
1111
| --------- | ---------------------------------------------------------------------------------------------------------------------------------- |
12+
| `v13.0.0` | SWC Minifier enabled by default. |
1213
| `v12.3.0` | SWC Minifier [stable](https://nextjs.org/blog/next-12-3#swc-minifier-stable). |
1314
| `v12.2.0` | [SWC Plugins](#swc-plugins-Experimental) experimental support added. |
1415
| `v12.1.0` | Added support for Styled Components, Jest, Relay, Remove React Properties, Legacy Decorators, Remove Console, and jsxImportSource. |
@@ -241,18 +242,18 @@ Only `importMap` in `@emotion/babel-plugin` is not supported for now.
241242

242243
### Minification
243244

244-
You can opt-in to using the Next.js compiler for minification. This is 7x faster than Terser.
245+
Next.js' swc compiler is used for minification by default since v13. This is 7x faster than Terser.
246+
247+
If Terser is still needed for any reason this can be configured.
245248

246249
```js
247250
// next.config.js
248251

249252
module.exports = {
250-
swcMinify: true,
253+
swcMinify: false,
251254
}
252255
```
253256

254-
If you have feedback about `swcMinify`, please share it on the [feedback discussion](https://github.com/vercel/next.js/discussions/30237).
255-
256257
## Experimental Features
257258

258259
### Minifier debug options
@@ -271,7 +272,6 @@ module.exports = {
271272
},
272273
},
273274
},
274-
swcMinify: true,
275275
}
276276
```
277277

packages/next/server/config-shared.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ export const defaultConfig: NextConfig = {
547547
},
548548
outputFileTracing: true,
549549
staticPageGenerationTimeout: 60,
550-
swcMinify: false,
550+
swcMinify: true,
551551
output: !!process.env.NEXT_PRIVATE_STANDALONE ? 'standalone' : undefined,
552552
experimental: {
553553
optimisticClientCache: true,

packages/next/server/config.ts

-7
Original file line numberDiff line numberDiff line change
@@ -471,13 +471,6 @@ function assignDefaults(userConfig: { [key: string]: any }) {
471471
)
472472
}
473473

474-
if (result.experimental && 'swcMinify' in (result.experimental as any)) {
475-
Log.warn(
476-
`\`swcMinify\` has been moved out of \`experimental\`. Please update your ${configFileName} file accordingly.`
477-
)
478-
result.swcMinify = (result.experimental as any).swcMinify
479-
}
480-
481474
if (result.experimental && 'relay' in (result.experimental as any)) {
482475
Log.warn(
483476
`\`relay\` has been moved out of \`experimental\` and into \`compiler\`. Please update your ${configFileName} file accordingly.`

test/.stats-app/stats-config.js

-28
Original file line numberDiff line numberDiff line change
@@ -129,33 +129,5 @@ module.exports = {
129129
// numRequests: 2500,
130130
// },
131131
},
132-
{
133-
title: 'Default Build with SWC minify',
134-
// renames to apply to make file names deterministic
135-
renames,
136-
configFiles: [
137-
{
138-
path: 'next.config.js',
139-
content: `
140-
module.exports = {
141-
experimental: {
142-
appDir: true,
143-
// remove after next stable relase (current v12.3.1)
144-
serverComponents: true
145-
},
146-
swcMinify: true,
147-
generateBuildId: () => 'BUILD_ID'
148-
}
149-
`,
150-
},
151-
],
152-
filesToTrack: clientGlobs,
153-
// will be output to fetched-pages/${pathname}.html
154-
pagesToFetch: [
155-
'http://localhost:$PORT/',
156-
'http://localhost:$PORT/link',
157-
'http://localhost:$PORT/withRouter',
158-
],
159-
},
160132
],
161133
}

0 commit comments

Comments
 (0)