Skip to content

Commit b745bd5

Browse files
authored
docs(other-options): expand guidance for name, parallelism, profile, and recordsInputPath (#8010)
1 parent c70e521 commit b745bd5

1 file changed

Lines changed: 62 additions & 0 deletions

File tree

src/content/configuration/other-options.mdx

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,8 @@ T> You can override properties in the loader context as webpack copies all prope
167167

168168
Name of the configuration. Used when loading multiple configurations.
169169

170+
This is especially useful when exporting an array of configurations. webpack uses `name` to identify each config in logs and stats output.
171+
170172
**webpack.config.js**
171173

172174
```javascript
@@ -176,18 +178,60 @@ export default {
176178
};
177179
```
178180

181+
For multi-configuration builds:
182+
183+
```javascript
184+
export default [
185+
{
186+
name: "client",
187+
target: "web",
188+
// ...
189+
},
190+
{
191+
name: "server",
192+
target: "node",
193+
// ...
194+
},
195+
];
196+
```
197+
179198
## parallelism
180199

181200
`number = 100`
182201

183202
Limit the number of parallel processed modules. Can be used to fine tune performance or to get more reliable profiling results.
184203

204+
Lower values reduce concurrent work and memory pressure, but may increase total build time. Higher values can improve throughput on powerful machines.
205+
206+
**webpack.config.js**
207+
208+
```javascript
209+
export default {
210+
// ...
211+
parallelism: 50,
212+
};
213+
```
214+
215+
Use cases:
216+
217+
- Reduce `parallelism` when builds hit memory limits (for example in constrained CI runners).
218+
- Increase it when you have enough CPU and memory and want to maximize build throughput.
219+
185220
## profile
186221

187222
`boolean`
188223

189224
Capture a "profile" of the application, including statistics and hints, which can then be dissected using the [Analyze](https://webpack.github.io/analyse/) tool. It will also log out a summary of module timings.
190225

226+
**webpack.config.js**
227+
228+
```javascript
229+
export default {
230+
// ...
231+
profile: true,
232+
};
233+
```
234+
191235
T> Combine `profile: true` with `parallelism: 1` to get correct timings. Note that this will slow down the build as well.
192236

193237
## recordsInputPath
@@ -196,6 +240,24 @@ T> Combine `profile: true` with `parallelism: 1` to get correct timings. Note th
196240

197241
Specify the file from which to read the last set of records. This can be used to rename a records file. See the example below.
198242

243+
When this option is set, webpack reads previously generated records from this path and uses them as input for stable module/chunk id tracking.
244+
245+
**webpack.config.js**
246+
247+
```javascript
248+
import path from "node:path";
249+
import { fileURLToPath } from "node:url";
250+
251+
const __filename = fileURLToPath(import.meta.url);
252+
const __dirname = path.dirname(__filename);
253+
254+
export default {
255+
// ...
256+
recordsInputPath: path.join(__dirname, "records.json"),
257+
recordsOutputPath: path.join(__dirname, "records-next.json"),
258+
};
259+
```
260+
199261
## recordsOutputPath
200262
201263
`string`

0 commit comments

Comments
 (0)