Skip to content

Commit 6ade61a

Browse files
chenxsansnitin315
andauthored
docs(plugins): document regexp for splitChunks.chunks (webpack#6888)
* docs(plugins): document regexp for splitChunks.chunks * Update src/content/plugins/split-chunks-plugin.mdx Co-authored-by: Nitin Kumar <[email protected]> --------- Co-authored-by: Nitin Kumar <[email protected]>
1 parent ce8cac4 commit 6ade61a

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/content/plugins/split-chunks-plugin.mdx

+14-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ By default webpack will generate names using origin and name of the chunk (e.g.
9898

9999
### splitChunks.chunks
100100

101-
`string = 'async'` `function (chunk)`
101+
`string = 'async'` `function (chunk)` `RegExp`
102102

103103
This indicates which chunks will be selected for optimization. When a string is provided, valid values are `all`, `async`, and `initial`. Providing `all` can be particularly powerful, because it means that chunks can be shared even between async and non-async chunks.
104104

@@ -134,6 +134,19 @@ module.exports = {
134134
};
135135
```
136136

137+
If you are using webpack version 5.86.0 or later, you can also pass a regular expression:
138+
139+
```js
140+
module.exports = {
141+
//...
142+
optimization: {
143+
splitChunks: {
144+
chunks: /foo/,
145+
},
146+
},
147+
};
148+
```
149+
137150
T> You can combine this configuration with the [HtmlWebpackPlugin](/plugins/html-webpack-plugin/). It will inject all the generated vendor chunks for you.
138151

139152
### splitChunks.maxAsyncRequests

0 commit comments

Comments
 (0)