Skip to content

Commit 7c0c1a0

Browse files
committed
Options: default performance to false if not the web/webworker target(webpack#6715)
1 parent 66ff412 commit 7c0c1a0

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

lib/WebpackOptionsDefaulter.js

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ const isProductionLikeMode = options => {
1313
return options.mode === "production" || !options.mode;
1414
};
1515

16+
const isWebLikeTarget = options => {
17+
return options.target === "web" || options.target === "webworker";
18+
};
19+
1620
class WebpackOptionsDefaulter extends OptionsDefaulter {
1721
constructor() {
1822
super();
@@ -166,25 +170,16 @@ class WebpackOptionsDefaulter extends OptionsDefaulter {
166170
this.set("node.__filename", "mock");
167171
this.set("node.__dirname", "mock");
168172

169-
this.set(
170-
"performance",
171-
"make",
172-
options => (isProductionLikeMode(options) ? false : undefined)
173-
);
174-
this.set("performance", "call", value => {
175-
if (typeof value === "boolean") {
176-
return value;
173+
this.set("performance", "make", options => {
174+
if (isWebLikeTarget(options) && isProductionLikeMode(options)) {
175+
return {};
177176
} else {
178-
return Object.assign({}, value);
177+
return false;
179178
}
180179
});
181180
this.set("performance.maxAssetSize", 250000);
182181
this.set("performance.maxEntrypointSize", 250000);
183-
this.set(
184-
"performance.hints",
185-
"make",
186-
options => (isProductionLikeMode(options) ? "warning" : false)
187-
);
182+
this.set("performance.hints", "warning");
188183

189184
this.set("optimization.removeAvailableModules", true);
190185
this.set("optimization.removeEmptyChunks", true);

0 commit comments

Comments
 (0)