Skip to content

Document webpack change: perf: improve FlagDependencyExportsPlugin for large JSON by depth #7502

Closed
@webpack-bot

Description

@webpack-bot

A pull request by @hai-x was merged and maintainers requested a documentation change.

See pull request: webpack/webpack#19058


What kind of change does this PR introduce?

perf only for development mode

Fixes webpack/webpack#18458

Did you add tests for your changes?
Yes

Does this PR introduce a breaking change?
No

What needs to be documented once your changes are merged?

Add two options to https://webpack.js.org/configuration/module/#moduleparser

for json

  • parse - Function that executes for a module source string and should return json-compatible data. Type ((input: string) => any), for For example we can use toml parser
const toml = require("toml");
 
module.exports = [
	{ 
		module: {
			rules: [
				{
					test: /\.toml$/,
					type: "json",
					parser: {
						parse(input) { 
							return toml.parse(input);
						}
					}
				}
			]
		}
	}
];
  • exportsDepth - The depth of json dependency flagged as exportInfo. In dev mode - 1, in prod - Infinity, Type number

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions