From c2398a2eeeec11a2cf5a61e12cd76d24edbbd37e Mon Sep 17 00:00:00 2001 From: sfger Date: Thu, 31 May 2018 06:50:06 +0800 Subject: [PATCH] fix(entry): fix a bug when `--display-entrypoints=false` does not hide entries (#464) * fix: fix a buy when `--display-entrypoints=false` does not hide entries * fix * test: add a test --- bin/webpack.js | 2 +- test/binCases/entry/display-entrypoints/a.js | 1 + test/binCases/entry/display-entrypoints/index.js | 1 + test/binCases/entry/display-entrypoints/stdin.js | 6 ++++++ test/binCases/entry/display-entrypoints/test.opts | 1 + test/binCases/entry/display-entrypoints/webpack.config.js | 5 +++++ 6 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 test/binCases/entry/display-entrypoints/a.js create mode 100644 test/binCases/entry/display-entrypoints/index.js create mode 100644 test/binCases/entry/display-entrypoints/stdin.js create mode 100644 test/binCases/entry/display-entrypoints/test.opts create mode 100644 test/binCases/entry/display-entrypoints/webpack.config.js diff --git a/bin/webpack.js b/bin/webpack.js index 5564fab59c5..0d123a14b78 100755 --- a/bin/webpack.js +++ b/bin/webpack.js @@ -357,7 +357,7 @@ For more information, see https://webpack.js.org/api/cli/.`); }); ifArg("display-entrypoints", function(bool) { - if (bool) outputOptions.entrypoints = true; + outputOptions.entrypoints = bool; }); ifArg("display-reasons", function(bool) { diff --git a/test/binCases/entry/display-entrypoints/a.js b/test/binCases/entry/display-entrypoints/a.js new file mode 100644 index 00000000000..aa7a96ad992 --- /dev/null +++ b/test/binCases/entry/display-entrypoints/a.js @@ -0,0 +1 @@ +module.exports = "fileA"; diff --git a/test/binCases/entry/display-entrypoints/index.js b/test/binCases/entry/display-entrypoints/index.js new file mode 100644 index 00000000000..0d24e266fe2 --- /dev/null +++ b/test/binCases/entry/display-entrypoints/index.js @@ -0,0 +1 @@ +module.exports = "index"; diff --git a/test/binCases/entry/display-entrypoints/stdin.js b/test/binCases/entry/display-entrypoints/stdin.js new file mode 100644 index 00000000000..b95951ea0d9 --- /dev/null +++ b/test/binCases/entry/display-entrypoints/stdin.js @@ -0,0 +1,6 @@ +"use strict"; + +module.exports = function testAssertions(code, stdout, stderr) { + expect(stdout.join(' ')).not.toContain("Entrypoint"); + expect(stderr).toHaveLength(0); +}; diff --git a/test/binCases/entry/display-entrypoints/test.opts b/test/binCases/entry/display-entrypoints/test.opts new file mode 100644 index 00000000000..274606ca547 --- /dev/null +++ b/test/binCases/entry/display-entrypoints/test.opts @@ -0,0 +1 @@ +--display-entrypoints false diff --git a/test/binCases/entry/display-entrypoints/webpack.config.js b/test/binCases/entry/display-entrypoints/webpack.config.js new file mode 100644 index 00000000000..7ae59c51e2c --- /dev/null +++ b/test/binCases/entry/display-entrypoints/webpack.config.js @@ -0,0 +1,5 @@ +var path = require("path"); + +module.exports = { + entry: path.resolve(__dirname, "./index"), +};