webpack.js.org
webpack.js.org copied to clipboard
Incorrect documentation or implementation for optimization.splitChunks.automaticNamePrefix
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 documentation problem
automaticNamePrefix has been removed in v5