Skip to content

Commit 6a10e48

Browse files
committed
docs: improve FlagDependencyExportsPlugin for large JSON by depth
1 parent 715b2ba commit 6a10e48

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

src/content/configuration/module.mdx

+47
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ contributors:
2323
- snitin315
2424
- vabushkevich
2525
- ahabhgk
26+
- hai-x
2627
---
2728

2829
These options determine how the [different types of modules](/concepts/modules) within a project will be treated.
@@ -705,6 +706,52 @@ The `'relative'` value for `module.parser.javascript.url` is available since web
705706
1. This is useful for SSR (Server side rendering) when base URL is not known by server (and it saves a few bytes). To be identical it must also be used for the client build.
706707
2. Also for static site generators, mini-css-plugin and html-plugin, etc. where server side rendering is commonly needed.
707708

709+
### module.parser.json
710+
711+
Configure options for json parser.
712+
713+
```js
714+
module.exports = {
715+
module: {
716+
parser: {
717+
json: {
718+
// options
719+
},
720+
},
721+
},
722+
};
723+
```
724+
725+
### module.parser.json.exportsDepth
726+
727+
The depth of json dependency flagged as `exportInfo`. By default, it is set to `Infinity` in production mode, and `1` in development mode.
728+
729+
- Type: `number`
730+
- Available: <Badge text='5.98.0+' />
731+
- Example:
732+
733+
```js
734+
module.exports = {
735+
module: {
736+
parser: {
737+
json: {
738+
// For example, for the following json
739+
// {
740+
// "depth_1": {
741+
// "depth_2": {
742+
// "depth_3": "foo"
743+
// }
744+
// },
745+
// "_depth_1": "bar"
746+
// }
747+
// when `exportsDepth: 1`, `depth_2` and `depth_3` will not be flagged as `exportInfo`.
748+
exportsDepth: 1,
749+
},
750+
},
751+
},
752+
};
753+
```
754+
708755
## module.noParse
709756

710757
`RegExp` `[RegExp]` `function(resource)` `string` `[string]`

0 commit comments

Comments
 (0)