Skip to content

Commit 29288b2

Browse files
docs: improve readability of optimization.chunkIds documentation (#8068)
1 parent 7ab0ebf commit 29288b2

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/content/configuration/optimization.mdx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,17 @@ export default {
4141

4242
## optimization.chunkIds
4343

44-
`boolean = false` `string: 'natural' | 'named' | 'size' | 'total-size' | 'deterministic'`
44+
`boolean` | `natural` | `named` | `size` | `total-size` | `deterministic`
4545

46-
Tells webpack which algorithm to use when choosing chunk ids. Setting `optimization.chunkIds` to `false` tells webpack that none of built-in algorithms should be used, as custom one can be provided via plugin. There are a couple of defaults for `optimization.chunkIds`:
46+
- `false`: disable webpack's built-in chunk id algorithm
47+
- one of the following values:
48+
- `'natural'`
49+
- `'named'`
50+
- `'size'`
51+
- `'total-size'`
52+
- `'deterministic'`
53+
54+
Tells Webpack which algorithm to use for chunk IDs. Setting `optimization.chunkIds` to `false` tells webpack that none of built-in algorithms should be used, as custom one can be provided via plugin. There are a couple of defaults for `optimization.chunkIds`:
4755

4856
The default value of `optimization.chunkIds` depends on the [`mode`](/configuration/mode/):
4957

@@ -135,6 +143,8 @@ W> If you are using webpack [CLI](/api/cli/), the webpack process will not exit
135143

136144
<Badge text="5.95.0+" />
137145

146+
T> IIFE (Immediately Invoked Function Expression) is a function that runs immediately after it is created. Webpack uses it to wrap code and avoid variable conflicts.
147+
138148
Use `optimization.avoidEntryIife` to avoid wrapping the entry module in an IIFE when it is required (search for `"This entry needs to be wrapped in an IIFE because"` in [JavascriptModulesPlugin](https://github.com/webpack/webpack/blob/main/lib/javascript/JavascriptModulesPlugin.js)). This approach helps optimize performance for JavaScript engines and enables tree shaking when building ESM libraries.
139149

140150
Currently, `optimization.avoidEntryIife` can only optimize a single entry module along with other modules.

0 commit comments

Comments
 (0)