From 4198eacf0af26acca1d4379277819128defb1d52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0?= Date: Wed, 28 May 2025 21:56:37 +0900 Subject: [PATCH 1/2] feat: stabilize `css.preprocessorMaxWorkers` and default to `true` (#19992) --- config/shared-options.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/config/shared-options.md b/config/shared-options.md index b2229f3a..5a41459f 100644 --- a/config/shared-options.md +++ b/config/shared-options.md @@ -278,11 +278,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 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. -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 From 89f7d840b56d08c17c77ca5c42c5f34a86959ad7 Mon Sep 17 00:00:00 2001 From: thinkasany <480968828@qq.com> Date: Thu, 29 May 2025 09:53:11 +0800 Subject: [PATCH 2/2] fix: resolved conflict --- config/shared-options.md | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/config/shared-options.md b/config/shared-options.md index 18399fdc..5699d03d 100644 --- a/config/shared-options.md +++ b/config/shared-options.md @@ -278,20 +278,12 @@ export default defineConfig({ ## css.preprocessorMaxWorkers -<<<<<<< HEAD -- **实验性:** [提供反馈](https://github.com/vitejs/vite/discussions/15835) - **类型:** `number | true` -- **默认:** `0`(不会创建任何 worker 线程,而是在主线程中运行) - -如果启用了这个选项,那么 CSS 预处理器会尽可能在 worker 线程中运行。`true` 表示 CPU 数量减 1。 -======= -- **Type:** `number | true` -- **Default:** `true` +- **默认:** `true` -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. +指定 CSS 预处理器可以使用的最大线程数。`true` 表示最多为 CPU 数量减 1。当设置为 `0` 时,Vite 将不会创建任何工作线程,而是在主线程中运行预处理器。 -Depending on the preprocessor options, Vite may run the preprocessors on the main thread even if this option is not set to `0`. ->>>>>>> 4198eacf0af26acca1d4379277819128defb1d52 +根据预处理器选项,即使此选项未设置为 `0`,Vite 也可能会在主线程上运行预处理器。 ## css.devSourcemap {#css-devsourcemap}