豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Commit 8f731e6

Browse files
authored
docs: Add more details to useLightningcss docs (#84581)
Adds a bit more context about the current state of the world. Adds a warning if you set this to anything other than `undefined` on Turbopack: ![Screenshot 2025-10-09 at 4.18.02 PM.png](https://app.graphite.dev/user-attachments/assets/fbe4c8f5-6b1f-466c-953c-b16ae2f33751.png)
1 parent 61a8037 commit 8f731e6

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

docs/01-app/03-api-reference/05-config/01-next-config-js/useLightningcss.mdx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,18 @@ description: Enable experimental support for Lightning CSS.
44
version: experimental
55
---
66

7-
Experimental support for using [Lightning CSS](https://lightningcss.dev), a fast CSS bundler and minifier, written in Rust.
7+
Experimental support for using [Lightning CSS](https://lightningcss.dev) with webpack. Lightning CSS is a fast CSS transformer and minifier, written in Rust.
8+
9+
If this option is not set, Next.js on webpack uses [PostCSS](https://postcss.org/) with [`postcss-preset-env`](https://www.npmjs.com/package/postcss-preset-env) by default.
10+
11+
Turbopack uses Lightning CSS by default since Next 14.2. This configuration option has no effect on Turbopack. Turbopack always uses Lightning CSS.
812

913
```ts filename="next.config.ts" switcher
1014
import type { NextConfig } from 'next'
1115

1216
const nextConfig: NextConfig = {
1317
experimental: {
14-
useLightningcss: true,
18+
useLightningcss: false, // default, ignored on Turbopack
1519
},
1620
}
1721

@@ -22,9 +26,16 @@ export default nextConfig
2226
/** @type {import('next').NextConfig} */
2327
const nextConfig = {
2428
experimental: {
25-
useLightningcss: true,
29+
useLightningcss: true, // disables PostCSS on webpack
2630
},
2731
}
2832

2933
module.exports = nextConfig
3034
```
35+
36+
## Version History
37+
38+
| Version | Changes |
39+
| -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
40+
| `15.1.0` | Support for `useSwcCss` was removed from Turbopack. |
41+
| `14.2.0` | Turbopack's default CSS processor was changed from `@swc/css` to Lightning CSS. `useLightningcss` became ignored on Turbopack, and a legacy `experimental.turbo.useSwcCss` option was added. |

packages/next/src/lib/turbopack-warning.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ const unsupportedTurbopackNextConfigOptions = [
4040
'experimental.fullySpecified',
4141
'experimental.urlImports',
4242
'experimental.slowModuleDetection',
43+
44+
// We always use lightningcss
45+
'experimental.useLightningcss',
4346
]
4447

4548
/** */

0 commit comments

Comments
 (0)