From f0bebc6824ff1ba77616f660c87928f4eb8a72ad Mon Sep 17 00:00:00 2001 From: Benjamin Lim Date: Tue, 7 Feb 2017 08:31:40 +0800 Subject: [PATCH] chore: remove overloaded CommonsChunkPlugin constructor https://github.com/webpack/webpack/blob/d7384e2f6a17187e59ec2831b41ee813ec158f14/lib/optimize/CommonsChunkPlugin.js#L10-L25 --- .../extract-text-webpack-plugin-tests.ts | 5 ++++- webpack/index.d.ts | 1 - webpack/webpack-tests.ts | 14 ++++++++------ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/extract-text-webpack-plugin/extract-text-webpack-plugin-tests.ts b/extract-text-webpack-plugin/extract-text-webpack-plugin-tests.ts index 62e522a348..63177ebde3 100644 --- a/extract-text-webpack-plugin/extract-text-webpack-plugin-tests.ts +++ b/extract-text-webpack-plugin/extract-text-webpack-plugin-tests.ts @@ -58,7 +58,10 @@ configuration = { configuration = { // ... plugins: [ - new optimize.CommonsChunkPlugin("commons", "commons.js"), + new optimize.CommonsChunkPlugin({ + name: "commons", + filename: "commons.js", + }), new ExtractTextPlugin("[name].css") ] }; diff --git a/webpack/index.d.ts b/webpack/index.d.ts index 9801249051..43ced0bce5 100644 --- a/webpack/index.d.ts +++ b/webpack/index.d.ts @@ -1002,7 +1002,6 @@ declare namespace webpack { new (options?: UglifyPluginOptions): Plugin; } interface CommonsChunkPluginStatic { - new (chunkName: string, filenames?: string | string[]): Plugin; new (options?: any): Plugin; } interface AggressiveMergingPluginStatic { diff --git a/webpack/webpack-tests.ts b/webpack/webpack-tests.ts index e2e643a1da..4ed9fc3b31 100644 --- a/webpack/webpack-tests.ts +++ b/webpack/webpack-tests.ts @@ -62,7 +62,10 @@ configuration = { filename: "bundle.js" }, plugins: [ - new webpack.optimize.CommonsChunkPlugin(/* chunkName= */"vendor", /* filename= */"vendor.bundle.js") + new webpack.optimize.CommonsChunkPlugin({ + name: "vendor", + filename: "vendor.bundle.js", + }), ] }; @@ -126,10 +129,6 @@ configuration = { output: { filename: "[name].js" }, - plugins: [ - new CommonsChunkPlugin("admin-commons.js", ["ap1", "ap2"]), - new CommonsChunkPlugin("commons.js", ["p1", "p2", "admin-commons.js"]) - ] }; //