Skip to content

Commit 2515ced

Browse files
authored
docs(resolve): clarify usage of ... to retain default conditionNames (#7499)
1 parent ce58b77 commit 2515ced

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/content/configuration/resolve.mdx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,32 @@ importing
303303
- `'foo/bar'` will resolve to `'foo/bar-node.js'` as the `"node"` key comes before `"require"` key in the conditional exports object.
304304
- `'foo/baz'` will resolve to `'foo/baz-node.js'`
305305

306+
If you want to add your custom field names while still retaining the default Webpack values, you can use `"..."`:
307+
308+
**webpack.config.js**
309+
310+
```js
311+
module.exports = {
312+
//...
313+
resolve: {
314+
conditionNames: ['my-custom-condition', '...'],
315+
},
316+
};
317+
```
318+
319+
Alternatively, to prioritize the deault conditions first, then add your custom conditions:
320+
321+
**webpack.config.js**
322+
323+
```js
324+
module.exports = {
325+
//...
326+
resolve: {
327+
conditionNames: ['...', 'my-custom-condition'],
328+
},
329+
};
330+
```
331+
306332
### resolve.descriptionFiles
307333

308334
`[string] = ['package.json']`

0 commit comments

Comments
 (0)