Skip to content

feat: stabilize css.preprocessorMaxWorkers and default to true #19992

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions docs/config/shared-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,11 +280,12 @@ export default defineConfig({

## css.preprocessorMaxWorkers

- **Experimental:** [Give Feedback](https://github.com/vitejs/vite/discussions/15835)
- **Type:** `number | true`
- **Default:** `0` (does not create any workers and run in the main thread)
- **Default:** `true`

Specifies how many threads CSS preprocessors will run on. `true` means the number of CPUs minus 1. When set to `0`, Vite will not create any workers and run the preprocessors in the main thread.

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

## css.devSourcemap

Expand Down
6 changes: 2 additions & 4 deletions packages/vite/src/node/plugins/css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,7 @@ export interface CSSOptions {
* If this option is set, preprocessors will run in workers when possible.
* `true` means the number of CPUs minus 1.
*
* @default 0
* @experimental
* @default true
*/
preprocessorMaxWorkers?: number | true
postcss?:
Expand Down Expand Up @@ -199,8 +198,7 @@ export const cssConfigDefaults = Object.freeze({
transformer: 'postcss',
// modules
// preprocessorOptions
/** @experimental */
preprocessorMaxWorkers: 0,
preprocessorMaxWorkers: true,
// postcss
/** @experimental */
devSourcemap: false,
Expand Down