cacheGroups: false -> configuration object that does not match the API schema

Bug report

What is the current behavior?

Getting following error message when setting:

    splitChunks: {
      cacheGroups: false   // <-- 
    }
webpack --mode development --env.node_env=development

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.

  • configuration.optimization.splitChunks should be one of these:
    false | object { chunks?, minSize?, minChunks?, maxAsyncRequests?, maxInitialRequests?, name?, filename?, automaticNameDelimiter?, cacheGroups? }
    -> Optimize duplication and caching by splitting chunks by shared modules and cache group
    Details:

    • configuration.optimization.splitChunks should be false
    • configuration.optimization.splitChunks.cacheGroups should be an object.
      -> Assign modules to a cache group (modules from different cache groups are tried to keep in separate chunks)
      error An unexpected error occurred: “Command failed.
      Exit code: 1

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

webpack.config.js:

    splitChunks: {
      cacheGroups: false
    }

What is the expected behavior?

The SplitChunks interface says:

cacheGroups?: false | string | ((...args: any[]) => any) | RegExp | { [key: string]: CacheGroupsOptions };

I would expect no error when setting it to false

Other relevant information:

webpack version: 4.8.3
Node.js version: v8.10.0
Operating System: Win 10
Additional tools: —

Author: Fantashit

1 thought on “cacheGroups: false -> configuration object that does not match the API schema

  1. cacheGroups: false is not valid.

    The schema contains enum: [false] inside of additionalProperties, which means any property value can be false i. e. cacheGroups: { xyz: false }, but cacheGroups itself must be an object. The typings are wrong.

Comments are closed.