Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
webpack-bot opened this issue Dec 19, 2024 · 1 comment

Comments

@webpack-bot
Copy link

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
@hai-x
Copy link
Contributor

hai-x commented Dec 19, 2024

I'll follow up later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants