Skip to content

Commit 002f45a

Browse files
committed
change "defaultedProduction" to undefined
inline mode file fix testcase
1 parent ff908de commit 002f45a

4 files changed

Lines changed: 7 additions & 8 deletions

File tree

lib/WebpackOptionsApply.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ class WebpackOptionsApply extends OptionsApply {
264264
new ImportPlugin(options.module).apply(compiler);
265265
new SystemPlugin(options.module).apply(compiler);
266266

267-
if(typeof options.mode !== "string" || options.mode === "defaultedProduction")
267+
if(typeof options.mode !== "string")
268268
new WarnNoModeSetPlugin().apply(compiler);
269269

270270
new EnsureChunkConditionsPlugin().apply(compiler);

lib/WebpackOptionsDefaulter.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,16 @@ const path = require("path");
88

99
const OptionsDefaulter = require("./OptionsDefaulter");
1010
const Template = require("./Template");
11-
const isProductionLikeMode = require("./util/mode");
11+
12+
const isProductionLikeMode = options => {
13+
return options.mode === "production" || !options.mode;
14+
};
1215

1316
class WebpackOptionsDefaulter extends OptionsDefaulter {
1417
constructor() {
1518
super();
1619

1720
this.set("entry", "./src");
18-
this.set("mode", "defaultedProduction");
1921

2022
this.set("devtool", "make", options => (options.mode === "development" ? "eval" : false));
2123
this.set("cache", "make", options => options.mode === "development");
@@ -140,7 +142,7 @@ class WebpackOptionsDefaulter extends OptionsDefaulter {
140142
this.set("node.__filename", "mock");
141143
this.set("node.__dirname", "mock");
142144

143-
this.set("performance", "make", options => (options.mode !== "production" ? false : undefined));
145+
this.set("performance", "make", options => (isProductionLikeMode(options) ? false : undefined));
144146
this.set("performance", "call", value => {
145147
if(typeof value === "boolean") {
146148
return value;

lib/util/mode.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

test/Compiler-caching.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ describe("Compiler (caching)", function() {
1212
this.timeout(15000);
1313

1414
function compile(entry, options, callback) {
15+
options.mode = "none";
1516
options = new WebpackOptionsDefaulter().process(options);
16-
options.mode = "production";
1717
options.cache = true;
1818
options.entry = entry;
1919
options.optimization.minimize = false;

0 commit comments

Comments
 (0)