From 4f5de57d73b00baea41d1621913427ad8bf725e2 Mon Sep 17 00:00:00 2001 From: Nitin Kumar Date: Mon, 2 Aug 2021 13:56:47 +0530 Subject: [PATCH 1/5] feat: sharabale configs --- packages/webpack-cli/lib/webpack-cli.js | 40 +++++ test/build/extends/extends.test.js | 150 ++++++++++++++++++ test/build/extends/first-webpack.config.js | 11 ++ test/build/extends/invalid-extend.config.js | 3 + test/build/extends/multi-extended.config.js | 13 ++ test/build/extends/one.webpack.config.js | 8 + test/build/extends/second-webpack.config.js | 11 ++ test/build/extends/simple-webpack.config.js | 8 + test/build/extends/src/first.js | 1 + test/build/extends/src/index.js | 1 + test/build/extends/src/multi.js | 1 + test/build/extends/src/second.js | 1 + test/build/extends/src/third.js | 1 + test/build/extends/third-webpack.config.js | 8 + test/build/extends/two.webpack.config.js | 8 + test/build/extends/webpack.config.js | 8 + .../help.test.js.snap.devServer3.webpack4 | 8 + 17 files changed, 281 insertions(+) create mode 100644 test/build/extends/extends.test.js create mode 100644 test/build/extends/first-webpack.config.js create mode 100644 test/build/extends/invalid-extend.config.js create mode 100644 test/build/extends/multi-extended.config.js create mode 100644 test/build/extends/one.webpack.config.js create mode 100644 test/build/extends/second-webpack.config.js create mode 100644 test/build/extends/simple-webpack.config.js create mode 100644 test/build/extends/src/first.js create mode 100644 test/build/extends/src/index.js create mode 100644 test/build/extends/src/multi.js create mode 100644 test/build/extends/src/second.js create mode 100644 test/build/extends/src/third.js create mode 100644 test/build/extends/third-webpack.config.js create mode 100644 test/build/extends/two.webpack.config.js create mode 100644 test/build/extends/webpack.config.js diff --git a/packages/webpack-cli/lib/webpack-cli.js b/packages/webpack-cli/lib/webpack-cli.js index 168d75d45da..68221fb5264 100644 --- a/packages/webpack-cli/lib/webpack-cli.js +++ b/packages/webpack-cli/lib/webpack-cli.js @@ -401,6 +401,7 @@ class WebpackCLI { const minimumHelpFlags = [ "config", "config-name", + "extends", "merge", "env", "mode", @@ -452,6 +453,17 @@ class WebpackCLI { ], description: "Merge two or more configurations using 'webpack-merge'.", }, + { + name: "extends", + alias: "e", + configs: [ + { + type: "string", + }, + ], + multiple: true, + description: "Extends a webpack configuration.", + }, // Complex configs { name: "env", @@ -1691,6 +1703,34 @@ class WebpackCLI { } } + let extendedConfigsOptions = []; + + // extend configurations provided in webpack configuration file + if (config.options.extends) { + extendedConfigsOptions.push(config.options); + } else if (Array.isArray(config.options)) { + extendedConfigsOptions = config.options.filter((config) => config.extends); + } + + // extend configurations provided via --extends + if (options.extends) { + extendedConfigsOptions.push({ extends: options.extends }); + delete options.extends; + } + + extendedConfigsOptions.forEach(async (configOptions) => { + if (configOptions.extends) { + options.config = []; + configOptions.extends.map(async (value) => { + options.config.push(path.resolve(value)); + }); + + delete configOptions.extends; + + await this.resolveConfig(options); + } + }); + if (options.configName) { const notFoundConfigNames = []; diff --git a/test/build/extends/extends.test.js b/test/build/extends/extends.test.js new file mode 100644 index 00000000000..17659048e6d --- /dev/null +++ b/test/build/extends/extends.test.js @@ -0,0 +1,150 @@ +"use strict"; + +const { run } = require("../../utils/test-utils"); + +describe("extends", () => { + it("should use webpack.config.js and use all extended configs", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, []); + + expect(exitCode).toBe(0); + expect(stderr).toBeFalsy(); + expect(stdout).toContain("webpack.config.js"); + expect(stdout).toContain("first-webpack.config.js"); + expect(stdout).toContain("second-webpack.config.js"); + expect(stdout).toContain("third-webpack.config.js"); + }); + + it("should use multi-extended.config.js and use all extended configs", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--config", + "./multi-extended.config.js", + ]); + + expect(exitCode).toBe(0); + expect(stderr).toBeFalsy(); + expect(stdout).toContain("multi-extended.config.js"); + expect(stdout).toContain("one.webpack.config.js"); + expect(stdout).toContain("two.webpack.config.js"); + expect(stdout).toContain("second-webpack.config.js"); + expect(stdout).toContain("third-webpack.config.js"); + }); + + it("should use extend configuration with --extends flag", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--config", + "./simple-webpack.config.js", + "--extends", + "./first-webpack.config.js", + ]); + + expect(exitCode).toBe(0); + expect(stderr).toBeFalsy(); + expect(stdout).toContain("simple-webpack.config.js"); + expect(stdout).toContain("first-webpack.config.js"); + expect(stdout).toContain("second-webpack.config.js"); + expect(stdout).toContain("third-webpack.config.js"); + }); + + it("should use extend multiple configurations with --extends flag", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--config", + "./simple-webpack.config.js", + "--extends", + "./one.webpack.config.js", + "--extends", + "./two.webpack.config.js", + ]); + + expect(exitCode).toBe(0); + expect(stderr).toBeFalsy(); + expect(stdout).toContain("simple-webpack.config.js"); + expect(stdout).toContain("one.webpack.config.js"); + expect(stdout).toContain("two.webpack.config.js"); + }); + + it("should use extend multiple configurations with --extends flag #2", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--config", + "./simple-webpack.config.js", + "--extends", + "./one.webpack.config.js", + "--extends", + "./two.webpack.config.js", + "--extends", + "./second-webpack.config.js", + ]); + + expect(exitCode).toBe(0); + expect(stderr).toBeFalsy(); + expect(stdout).toContain("simple-webpack.config.js"); + expect(stdout).toContain("one.webpack.config.js"); + expect(stdout).toContain("two.webpack.config.js"); + expect(stdout).toContain("second-webpack.config.js"); + expect(stdout).toContain("third-webpack.config.js"); + }); + + it("should use extend configuration with -e alias", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--config", + "./simple-webpack.config.js", + "-e", + "./first-webpack.config.js", + ]); + + expect(exitCode).toBe(0); + expect(stderr).toBeFalsy(); + expect(stdout).toContain("simple-webpack.config.js"); + expect(stdout).toContain("first-webpack.config.js"); + expect(stdout).toContain("second-webpack.config.js"); + expect(stdout).toContain("third-webpack.config.js"); + }); + + it("should use extend multiple configurations with -e alias", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--config", + "./simple-webpack.config.js", + "-e", + "./one.webpack.config.js", + "-e", + "./two.webpack.config.js", + ]); + + expect(exitCode).toBe(0); + expect(stderr).toBeFalsy(); + expect(stdout).toContain("simple-webpack.config.js"); + expect(stdout).toContain("one.webpack.config.js"); + expect(stdout).toContain("two.webpack.config.js"); + }); + + it("should use extend multiple configurations with -e alias #2", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--config", + "./simple-webpack.config.js", + "--extends", + "./one.webpack.config.js", + "--extends", + "./two.webpack.config.js", + "--extends", + "./second-webpack.config.js", + ]); + + expect(exitCode).toBe(0); + expect(stderr).toBeFalsy(); + expect(stdout).toContain("simple-webpack.config.js"); + expect(stdout).toContain("one.webpack.config.js"); + expect(stdout).toContain("two.webpack.config.js"); + expect(stdout).toContain("second-webpack.config.js"); + expect(stdout).toContain("third-webpack.config.js"); + }); + + it("should throw an error for invalid-extend.config.js", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--config", + "./invalid-extend.config.js", + ]); + + expect(exitCode).toBe(2); + expect(stderr).toContain(`Error: Cannot find module`); + expect(stdout).toBeFalsy(); + }); +}); diff --git a/test/build/extends/first-webpack.config.js b/test/build/extends/first-webpack.config.js new file mode 100644 index 00000000000..37deb940463 --- /dev/null +++ b/test/build/extends/first-webpack.config.js @@ -0,0 +1,11 @@ +const path = require("path"); + +module.exports = () => { + console.log("first-webpack.config.js"); + + return { + mode: "development", + entry: "./src/first.js", + extends: [path.resolve(__dirname, "./second-webpack.config.js")], + }; +}; diff --git a/test/build/extends/invalid-extend.config.js b/test/build/extends/invalid-extend.config.js new file mode 100644 index 00000000000..5a7394570c2 --- /dev/null +++ b/test/build/extends/invalid-extend.config.js @@ -0,0 +1,3 @@ +module.exports = { + extends: ["./invalid-config.js"], +}; diff --git a/test/build/extends/multi-extended.config.js b/test/build/extends/multi-extended.config.js new file mode 100644 index 00000000000..41d068d0699 --- /dev/null +++ b/test/build/extends/multi-extended.config.js @@ -0,0 +1,13 @@ +module.exports = () => { + console.log("multi-extended.config.js"); + + return { + extends: [ + "./one.webpack.config.js", + "./two.webpack.config.js", + "./second-webpack.config.js", + ], + target: "node", + entry: "./src/multi.js", + }; +}; diff --git a/test/build/extends/one.webpack.config.js b/test/build/extends/one.webpack.config.js new file mode 100644 index 00000000000..5344fabc58b --- /dev/null +++ b/test/build/extends/one.webpack.config.js @@ -0,0 +1,8 @@ +module.exports = () => { + console.log("one.webpack.config.js"); + + return { + mode: "development", + entry: "./src/first.js", + }; +}; diff --git a/test/build/extends/second-webpack.config.js b/test/build/extends/second-webpack.config.js new file mode 100644 index 00000000000..84d9edcafb8 --- /dev/null +++ b/test/build/extends/second-webpack.config.js @@ -0,0 +1,11 @@ +const path = require("path"); + +module.exports = () => { + console.log("second-webpack.config.js"); + + return { + mode: "development", + entry: "./src/second.js", + extends: [path.resolve(__dirname, "./third-webpack.config.js")], + }; +}; diff --git a/test/build/extends/simple-webpack.config.js b/test/build/extends/simple-webpack.config.js new file mode 100644 index 00000000000..89eb085f1f1 --- /dev/null +++ b/test/build/extends/simple-webpack.config.js @@ -0,0 +1,8 @@ +module.exports = () => { + console.log("simple-webpack.config.js"); + + return { + mode: "development", + entry: "./src/index.js", + }; +}; diff --git a/test/build/extends/src/first.js b/test/build/extends/src/first.js new file mode 100644 index 00000000000..cfd047ba6ff --- /dev/null +++ b/test/build/extends/src/first.js @@ -0,0 +1 @@ +console.log("first.js"); diff --git a/test/build/extends/src/index.js b/test/build/extends/src/index.js new file mode 100644 index 00000000000..83520f3d904 --- /dev/null +++ b/test/build/extends/src/index.js @@ -0,0 +1 @@ +console.log("index"); diff --git a/test/build/extends/src/multi.js b/test/build/extends/src/multi.js new file mode 100644 index 00000000000..52eae5e660b --- /dev/null +++ b/test/build/extends/src/multi.js @@ -0,0 +1 @@ +console.log("multi"); diff --git a/test/build/extends/src/second.js b/test/build/extends/src/second.js new file mode 100644 index 00000000000..5023a5896d0 --- /dev/null +++ b/test/build/extends/src/second.js @@ -0,0 +1 @@ +console.log("second"); diff --git a/test/build/extends/src/third.js b/test/build/extends/src/third.js new file mode 100644 index 00000000000..f532661b412 --- /dev/null +++ b/test/build/extends/src/third.js @@ -0,0 +1 @@ +console.log("third"); diff --git a/test/build/extends/third-webpack.config.js b/test/build/extends/third-webpack.config.js new file mode 100644 index 00000000000..3ab6c66e3d9 --- /dev/null +++ b/test/build/extends/third-webpack.config.js @@ -0,0 +1,8 @@ +module.exports = () => { + console.log("third-webpack.config.js"); + + return { + stats: "detalied", + entry: "./src/third.js", + }; +}; diff --git a/test/build/extends/two.webpack.config.js b/test/build/extends/two.webpack.config.js new file mode 100644 index 00000000000..9a8abda089d --- /dev/null +++ b/test/build/extends/two.webpack.config.js @@ -0,0 +1,8 @@ +module.exports = () => { + console.log("two.webpack.config.js"); + + return { + mode: "development", + entry: "./src/second.js", + }; +}; diff --git a/test/build/extends/webpack.config.js b/test/build/extends/webpack.config.js new file mode 100644 index 00000000000..704a6f2d6de --- /dev/null +++ b/test/build/extends/webpack.config.js @@ -0,0 +1,8 @@ +module.exports = () => { + console.log("webpack.config.js"); + + return { + extends: ["./first-webpack.config.js"], + target: "node", + }; +}; diff --git a/test/help/__snapshots__/help.test.js.snap.devServer3.webpack4 b/test/help/__snapshots__/help.test.js.snap.devServer3.webpack4 index c8b13330a95..9c70b98b4b6 100644 --- a/test/help/__snapshots__/help.test.js.snap.devServer3.webpack4 +++ b/test/help/__snapshots__/help.test.js.snap.devServer3.webpack4 @@ -97,6 +97,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -153,6 +154,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -209,6 +211,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -264,6 +267,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -306,6 +310,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -350,6 +355,7 @@ Options: --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. @@ -401,6 +407,7 @@ Options: --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. @@ -2698,6 +2705,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. From f0700fd7c1233e23e0aad00197b7b734c8b9daa1 Mon Sep 17 00:00:00 2001 From: Nitin Kumar Date: Mon, 9 Aug 2021 16:10:35 +0530 Subject: [PATCH 2/5] test: update snapshots --- .../help.test.js.snap.devServer3.webpack4 | 24 +++++++++++++++-- .../help.test.js.snap.devServer3.webpack5 | 27 +++++++++++++++++++ .../help.test.js.snap.devServer4.webpack4 | 19 +++++++++++++ .../help.test.js.snap.devServer4.webpack5 | 19 +++++++++++++ 4 files changed, 87 insertions(+), 2 deletions(-) diff --git a/test/help/__snapshots__/help.test.js.snap.devServer3.webpack4 b/test/help/__snapshots__/help.test.js.snap.devServer3.webpack4 index 9c70b98b4b6..5374513376e 100644 --- a/test/help/__snapshots__/help.test.js.snap.devServer3.webpack4 +++ b/test/help/__snapshots__/help.test.js.snap.devServer3.webpack4 @@ -267,7 +267,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. - -e, --extends Extends a webpack configuration. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -310,7 +310,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. - -e, --extends Extends a webpack configuration. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -457,6 +457,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -499,6 +500,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -1533,6 +1535,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -1603,6 +1606,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -1675,6 +1679,7 @@ Options: --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. @@ -1760,6 +1765,7 @@ Options: --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. @@ -1843,6 +1849,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -1913,6 +1920,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -1983,6 +1991,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -2053,6 +2062,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -2163,6 +2173,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -2203,6 +2214,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -2245,6 +2257,7 @@ Options: --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. @@ -2294,6 +2307,7 @@ Options: --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. @@ -2341,6 +2355,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -2381,6 +2396,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -2422,6 +2438,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -2478,6 +2495,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -2706,6 +2724,7 @@ Options: --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. -e, --extends Extends a webpack configuration. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -2760,6 +2779,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. diff --git a/test/help/__snapshots__/help.test.js.snap.devServer3.webpack5 b/test/help/__snapshots__/help.test.js.snap.devServer3.webpack5 index 37c30d8aefb..6f3d3c10efb 100644 --- a/test/help/__snapshots__/help.test.js.snap.devServer3.webpack5 +++ b/test/help/__snapshots__/help.test.js.snap.devServer3.webpack5 @@ -97,6 +97,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -154,6 +155,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -211,6 +213,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -267,6 +270,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -310,6 +314,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -355,6 +360,7 @@ Options: --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. @@ -407,6 +413,7 @@ Options: --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. @@ -457,6 +464,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -500,6 +508,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -1535,6 +1544,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -1606,6 +1616,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -1679,6 +1690,7 @@ Options: --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. @@ -1765,6 +1777,7 @@ Options: --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. @@ -1849,6 +1862,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -1920,6 +1934,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -1991,6 +2006,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -2062,6 +2078,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -2173,6 +2190,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -2214,6 +2232,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -2257,6 +2276,7 @@ Options: --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. @@ -2307,6 +2327,7 @@ Options: --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. @@ -2355,6 +2376,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -2396,6 +2418,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -2438,6 +2461,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -2495,6 +2519,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -2741,6 +2766,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -2796,6 +2822,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. diff --git a/test/help/__snapshots__/help.test.js.snap.devServer4.webpack4 b/test/help/__snapshots__/help.test.js.snap.devServer4.webpack4 index 8e6d3c6e502..b1b43041d82 100644 --- a/test/help/__snapshots__/help.test.js.snap.devServer4.webpack4 +++ b/test/help/__snapshots__/help.test.js.snap.devServer4.webpack4 @@ -97,6 +97,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -153,6 +154,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -209,6 +211,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -264,6 +267,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -306,6 +310,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -350,6 +355,7 @@ Options: --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. @@ -401,6 +407,7 @@ Options: --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. @@ -450,6 +457,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -492,6 +500,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -1582,6 +1591,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -1622,6 +1632,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -1664,6 +1675,7 @@ Options: --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. @@ -1713,6 +1725,7 @@ Options: --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. @@ -1760,6 +1773,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -1800,6 +1814,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -1842,6 +1857,7 @@ Options: --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. --env Environment passed to the configuration when it is a function. + -e, --extends Extends a webpack configuration. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. -j, --json [value] Prints result as JSON or store it in a file. @@ -1897,6 +1913,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -2124,6 +2141,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -2178,6 +2196,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. diff --git a/test/help/__snapshots__/help.test.js.snap.devServer4.webpack5 b/test/help/__snapshots__/help.test.js.snap.devServer4.webpack5 index 56259dec98e..dd57a986920 100644 --- a/test/help/__snapshots__/help.test.js.snap.devServer4.webpack5 +++ b/test/help/__snapshots__/help.test.js.snap.devServer4.webpack5 @@ -97,6 +97,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -154,6 +155,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -211,6 +213,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -267,6 +270,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -310,6 +314,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -355,6 +360,7 @@ Options: --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. @@ -407,6 +413,7 @@ Options: --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. @@ -457,6 +464,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -500,6 +508,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -1591,6 +1600,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -1632,6 +1642,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -1675,6 +1686,7 @@ Options: --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. @@ -1725,6 +1737,7 @@ Options: --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. @@ -1773,6 +1786,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -1814,6 +1828,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -1856,6 +1871,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -1913,6 +1929,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -2159,6 +2176,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. @@ -2214,6 +2232,7 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. + -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. From 28d68270cc24564800ec885d702d6dcba99d20ac Mon Sep 17 00:00:00 2001 From: Nitin Kumar Date: Mon, 9 Aug 2021 17:05:47 +0530 Subject: [PATCH 3/5] test: more --- test/build/extends/extends.test.js | 33 ++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/test/build/extends/extends.test.js b/test/build/extends/extends.test.js index 17659048e6d..a45f2010195 100644 --- a/test/build/extends/extends.test.js +++ b/test/build/extends/extends.test.js @@ -62,6 +62,39 @@ describe("extends", () => { expect(stdout).toContain("two.webpack.config.js"); }); + it("should work with multiple --config flags", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--config", + "./simple-webpack.config.js", + "--config", + "./webpack.config.js", + ]); + + expect(exitCode).toBe(0); + expect(stderr).toBeFalsy(); + expect(stdout).toContain("simple-webpack.config.js"); + expect(stdout).toContain("webpack.config.js"); + expect(stdout).toContain("first-webpack.config.js"); + expect(stdout).toContain("second-webpack.config.js"); + expect(stdout).toContain("third-webpack.config.js"); + }); + + it("should work with multiple --merge flag", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--config", + "./simple-webpack.config.js", + "--config", + "./second-webpack.config.js", + "--merge", + ]); + + expect(exitCode).toBe(0); + expect(stderr).toBeFalsy(); + expect(stdout).toContain("simple-webpack.config.js"); + expect(stdout).toContain("second-webpack.config.js"); + expect(stdout).toContain("third-webpack.config.js"); + }); + it("should use extend multiple configurations with --extends flag #2", async () => { const { exitCode, stderr, stdout } = await run(__dirname, [ "--config", From 814f1c4b8752609a6044081f6fb9d59312d7268b Mon Sep 17 00:00:00 2001 From: Nitin Kumar Date: Mon, 9 Aug 2021 17:23:39 +0530 Subject: [PATCH 4/5] test: multi compiler mode --- packages/webpack-cli/lib/webpack-cli.js | 7 ++-- test/build/extends/extends.test.js | 40 +++++++++++++++++++++ test/build/extends/multi-compiler.config.js | 17 +++++++++ 3 files changed, 61 insertions(+), 3 deletions(-) create mode 100644 test/build/extends/multi-compiler.config.js diff --git a/packages/webpack-cli/lib/webpack-cli.js b/packages/webpack-cli/lib/webpack-cli.js index 68221fb5264..b053efc36a0 100644 --- a/packages/webpack-cli/lib/webpack-cli.js +++ b/packages/webpack-cli/lib/webpack-cli.js @@ -1720,14 +1720,15 @@ class WebpackCLI { extendedConfigsOptions.forEach(async (configOptions) => { if (configOptions.extends) { - options.config = []; + const newOptions = { config: [] }; + configOptions.extends.map(async (value) => { - options.config.push(path.resolve(value)); + newOptions.config.push(path.resolve(value)); }); delete configOptions.extends; - await this.resolveConfig(options); + await this.resolveConfig(newOptions); } }); diff --git a/test/build/extends/extends.test.js b/test/build/extends/extends.test.js index a45f2010195..fb7e76d1350 100644 --- a/test/build/extends/extends.test.js +++ b/test/build/extends/extends.test.js @@ -62,6 +62,46 @@ describe("extends", () => { expect(stdout).toContain("two.webpack.config.js"); }); + it("should work in multi compiler mode", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--config", + "./multi-compiler.config.js", + ]); + + expect(exitCode).toBe(0); + expect(stderr).toBeFalsy(); + // config names + expect(stdout).toContain("multi-compiler.config.js"); + expect(stdout).toContain("webpack.config.js"); + expect(stdout).toContain("first-webpack.config.js"); + expect(stdout).toContain("second-webpack.config.js"); + expect(stdout).toContain("third-webpack.config.js"); + // compiler names + expect(stdout).toContain("first-compiler"); + expect(stdout).toContain("second-compiler"); + }); + + it("should work in multi compiler mode with --config-name", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--config", + "./multi-compiler.config.js", + "--config-name", + "second-compiler", + ]); + + expect(exitCode).toBe(0); + expect(stderr).toBeFalsy(); + // config names + expect(stdout).toContain("multi-compiler.config.js"); + expect(stdout).toContain("webpack.config.js"); + expect(stdout).toContain("first-webpack.config.js"); + expect(stdout).toContain("second-webpack.config.js"); + expect(stdout).toContain("third-webpack.config.js"); + // compiler names + expect(stdout).not.toContain("first-compiler"); + expect(stdout).toContain("second-compiler"); + }); + it("should work with multiple --config flags", async () => { const { exitCode, stderr, stdout } = await run(__dirname, [ "--config", diff --git a/test/build/extends/multi-compiler.config.js b/test/build/extends/multi-compiler.config.js new file mode 100644 index 00000000000..2e9da1a349e --- /dev/null +++ b/test/build/extends/multi-compiler.config.js @@ -0,0 +1,17 @@ +module.exports = () => { + console.log("multi-compiler.config.js"); + + return [ + { + mode: "development", + entry: "./src/first.js", + name: "first-compiler", + }, + { + mode: "development", + entry: "./src/second.js", + name: "second-compiler", + extends: ["./webpack.config.js"], + }, + ]; +}; From 8e352fa6b01092bc566242c446656a3338d2f557 Mon Sep 17 00:00:00 2001 From: Nitin Kumar Date: Mon, 9 Aug 2021 17:55:14 +0530 Subject: [PATCH 5/5] fix: snapshot --- test/help/__snapshots__/help.test.js.snap.devServer3.webpack4 | 1 - test/help/__snapshots__/help.test.js.snap.devServer4.webpack4 | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/test/help/__snapshots__/help.test.js.snap.devServer3.webpack4 b/test/help/__snapshots__/help.test.js.snap.devServer3.webpack4 index 5374513376e..6f86da42ef7 100644 --- a/test/help/__snapshots__/help.test.js.snap.devServer3.webpack4 +++ b/test/help/__snapshots__/help.test.js.snap.devServer3.webpack4 @@ -2724,7 +2724,6 @@ Options: --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. -e, --extends Extends a webpack configuration. - -e, --extends Extends a webpack configuration. --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. diff --git a/test/help/__snapshots__/help.test.js.snap.devServer4.webpack4 b/test/help/__snapshots__/help.test.js.snap.devServer4.webpack4 index b1b43041d82..0b19d80f756 100644 --- a/test/help/__snapshots__/help.test.js.snap.devServer4.webpack4 +++ b/test/help/__snapshots__/help.test.js.snap.devServer4.webpack4 @@ -1856,8 +1856,8 @@ Options: -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. - --env Environment passed to the configuration when it is a function. -e, --extends Extends a webpack configuration. + --env Environment passed to the configuration when it is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. -j, --json [value] Prints result as JSON or store it in a file.