From fa5666117a2d80fdde2ec29ddd7590a8a7d4af18 Mon Sep 17 00:00:00 2001 From: Kevin O'Neil <42050201+fr-kevin@users.noreply.github.com> Date: Wed, 3 Oct 2018 22:58:24 +0900 Subject: [PATCH] Webpack: Adds maxSize as option to CacheGroupsOptions and SplitChunksOptions (#29401) * Adds maxSize as option to CacheGroups and SplitChunks * Adds test for maxSize * Adds another minSize/maxSize test and modifies original amount --- types/webpack/index.d.ts | 4 ++++ types/webpack/webpack-tests.ts | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/types/webpack/index.d.ts b/types/webpack/index.d.ts index cf13359e0e..28747291e4 100644 --- a/types/webpack/index.d.ts +++ b/types/webpack/index.d.ts @@ -576,6 +576,8 @@ declare namespace webpack { priority?: number; /** Minimal size for the created chunk */ minSize?: number; + /** Maximum size for the created chunk */ + maxSize?: number; /** Minimum number of times a module has to be duplicated until it's considered for splitting */ minChunks?: number; /** Maximum number of requests which are accepted for on-demand loading */ @@ -592,6 +594,8 @@ declare namespace webpack { chunks?: "initial" | "async" | "all" | ((chunk: compilation.Chunk) => boolean); /** Minimal size for the created chunk */ minSize?: number; + /** Maximum size for the created chunk */ + maxSize?: number; /** Minimum number of times a module has to be duplicated until it's considered for splitting */ minChunks?: number; /** Maximum number of requests which are accepted for on-demand loading */ diff --git a/types/webpack/webpack-tests.ts b/types/webpack/webpack-tests.ts index ab0755d0e6..626aba6ac9 100644 --- a/types/webpack/webpack-tests.ts +++ b/types/webpack/webpack-tests.ts @@ -632,12 +632,16 @@ configuration = { mode: "production", optimization: { splitChunks: { + minSize: 30000, + maxSize: 50000, cacheGroups: { default: false, vendor: { chunks: "initial", test: "node_modules", name: "vendor", + minSize: 30000, + maxSize: 50000, enforce: true } }