You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/docs/en/config/module.mdx
+12-6Lines changed: 12 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2646,7 +2646,13 @@ export default {
2646
2646
- **Type**: `boolean`
2647
2647
- **Default:** `false`
2648
2648
2649
-
In version 1.3.1, the `Rule.use.parallel` configuration option was introduced. When enabled for corresponding loaders and `experiments.parallelLoader=true` is configured, the respective loaders will be executed in worker threads:
2649
+
Controls whether a given loader should run in worker threads for parallel execution. Loaders marked with `parallel` are scheduled across multiple threads, reducing pressure on the main thread and improving overall build performance.
2650
+
2651
+
- When set to `true`, the loader runs in a worker. Rspack automatically selects an appropriate number of worker threads.
2652
+
- When set to `{ maxWorkers }`, you can explicitly define the maximum number of workers to use.
2653
+
- When set to `false` or omitted, the loader runs on the main thread.
2654
+
2655
+
For example, enabling parallel execution for `less-loader`:
2650
2656
2651
2657
```js title="rspack.config.mjs"
2652
2658
exportdefault {
@@ -2672,13 +2678,13 @@ export default {
2672
2678
};
2673
2679
```
2674
2680
2675
-
When multiple loaders in the current `Rule` are configured with `Rule.use.parallel=true`, Rspack will execute all loader tasks in the same worker until it encounters the next loader without the `parallel` flag or a Rust`builtin:` loader. This approach enhances loader parallel performance.
2681
+
When multiple loaders within the same rule have `parallel` enabled, Rspack executes them sequentially inside the same worker until it encounters a non-parallel loader or a Rust-implemented builtin loader. This preserves loader order while maximizing parallel efficiency.
2676
2682
2677
-
:::warning
2683
+
:::tip
2678
2684
2679
-
- This configuration only takes effect when [experiments.parallelLoader](/config/experiments#experimentsparallelloader) is enabled.
2680
-
- The loader configuration must comply with the [HTML structured clone algorithm](https://nodejs.org/api/worker_threads.html#portpostmessagevalue-transferlist), otherwise transmission will fail.
2681
-
- Currently, Rspack does not support most of the methods on `LoaderContext._compilation`, `LoaderContext._compiler`, `LoaderContext._module`.
2685
+
- This feature is experimental. It only takes effect when [experiments.parallelLoader](/config/experiments#experimentsparallelloader) is enabled.
2686
+
- The loader options must comply with the [HTML structured clone algorithm](https://nodejs.org/api/worker_threads.html#portpostmessagevalue-transferlist), otherwise transmission will fail.
2687
+
- In worker mode, most methods on `LoaderContext._compilation`, `LoaderContext._compiler`, `LoaderContext._module` are not supported.
0 commit comments