webpack.js.org icon indicating copy to clipboard operation
webpack.js.org copied to clipboard

Incorrect documentation or implementation for optimization.splitChunks.automaticNamePrefix

Open simonbrent opened this issue 4 years ago • 1 comments

Bug report

What is the current behavior?

If optimization.splitChunks.automaticNamePrefix is set, an error occurs:

WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema. configuration.optimization.splitChunks has an unknown property 'automaticNamePrefix'. These properties are valid:
object { automaticNameDelimiter?, automaticNameMaxLength?, cacheGroups?, chunks?, fallbackCacheGroup?, filename?, hidePathInfo?, maxAsyncRequests?, maxInitialRequests?, maxSize?, minChunks?, minSize?, name? }

If the current behavior is a bug, please provide the steps to reproduce.

Set optimization.splitChunks.automaticNamePrefix to any string

What is the expected behavior?

Either optimization.splitChunks.automaticNamePrefix should be respected, or the documentation at https://webpack.js.org/plugins/split-chunks-plugin/#splitchunksautomaticnamedelimiter should be corrected to reflect the fact that it is only allowed within cacheGroups.

The reason for this is that automaticNamePrefix is only present within the cacheGroups section of OptimizationSplitChunksOptions in schema/WebpackOptions.json, and not in OptimizationSplitChunksOptions top level properties. See https://github.com/webpack/webpack/blob/webpack-4/schemas/WebpackOptions.json#L595

Other relevant information: webpack version: 4.43.0 Node.js version: 10.20.1 Operating System: Additional tools:

simonbrent avatar Jul 07 '20 12:07 simonbrent

@simonbrent documentation problem

alexander-akait avatar Jul 07 '20 15:07 alexander-akait

automaticNamePrefix has been removed in v5

snitin315 avatar Mar 22 '24 16:03 snitin315