Skip to content

Commit 70aee13

Browse files
authored
feat: stabilize css.preprocessorMaxWorkers and default to true (#19992)
1 parent 261fad9 commit 70aee13

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

docs/config/shared-options.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,11 +278,12 @@ export default defineConfig({
278278

279279
## css.preprocessorMaxWorkers
280280

281-
- **Experimental:** [Give Feedback](https://github.com/vitejs/vite/discussions/15835)
282281
- **Type:** `number | true`
283-
- **Default:** `0` (does not create any workers and run in the main thread)
282+
- **Default:** `true`
283+
284+
Specifies the maximum number of threads CSS preprocessors can use. `true` means up to the number of CPUs minus 1. When set to `0`, Vite will not create any workers and will run the preprocessors in the main thread.
284285

285-
If this option is set, CSS preprocessors will run in workers when possible. `true` means the number of CPUs minus 1.
286+
Depending on the preprocessor options, Vite may run the preprocessors on the main thread even if this option is not set to `0`.
286287

287288
## css.devSourcemap
288289

packages/vite/src/node/plugins/css.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,7 @@ export interface CSSOptions {
143143
* If this option is set, preprocessors will run in workers when possible.
144144
* `true` means the number of CPUs minus 1.
145145
*
146-
* @default 0
147-
* @experimental
146+
* @default true
148147
*/
149148
preprocessorMaxWorkers?: number | true
150149
postcss?:
@@ -198,8 +197,7 @@ export const cssConfigDefaults = Object.freeze({
198197
transformer: 'postcss',
199198
// modules
200199
// preprocessorOptions
201-
/** @experimental */
202-
preprocessorMaxWorkers: 0,
200+
preprocessorMaxWorkers: true,
203201
// postcss
204202
/** @experimental */
205203
devSourcemap: false,

0 commit comments

Comments
 (0)