From 5b64d8fb14247e3f717147ddbfb58b57d45caaf4 Mon Sep 17 00:00:00 2001 From: eivindh Date: Sun, 18 Mar 2018 12:56:34 +0100 Subject: [PATCH] Fixed SplitChunksOptions.cacheGroups not accepting dictionary --- types/webpack/index.d.ts | 2 +- types/webpack/webpack-tests.ts | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/types/webpack/index.d.ts b/types/webpack/index.d.ts index 2277ec2867..c6f4ae6c12 100644 --- a/types/webpack/index.d.ts +++ b/types/webpack/index.d.ts @@ -551,7 +551,7 @@ declare namespace webpack { /** Give chunks created a name (chunks with equal name are merged) */ name?: boolean | string | ((...args: any[]) => any); /** Assign modules to a cache group (modules from different cache groups are tried to keep in separate chunks) */ - cacheGroups?: false | string | ((...args: any[]) => any) | RegExp | CacheGroupsOptions; + cacheGroups?: false | string | ((...args: any[]) => any) | RegExp | { [key: string]: CacheGroupsOptions }; } interface RuntimeChunkOptions { /** The name or name factory for the runtime chunks. */ diff --git a/types/webpack/webpack-tests.ts b/types/webpack/webpack-tests.ts index 8fe0ab1e4d..f6295d99da 100644 --- a/types/webpack/webpack-tests.ts +++ b/types/webpack/webpack-tests.ts @@ -582,6 +582,22 @@ configuration = { } }; +configuration = { + mode: "production", + optimization: { + splitChunks: { + cacheGroups: { + vendor: { + chunks: "initial", + test: "node_modules", + name: "vendor", + enforce: true + } + } + } + }, +}; + plugin = new webpack.SplitChunksPlugin({ chunks: "async", minChunks: 2 }); class SingleEntryDependency extends webpack.compilation.Dependency {}