Skip to content

Commit 5f44819

Browse files
cletuswsokra
authored andcommitted
Support UglifyJsPlugin with no arguments in CLI --plugin
UglifyJsPlugin checks `typeof options !== "object"`, which doesn't work as expected with `null` since its type is `"object"`. https://github.com/webpack/webpack/blob/a1dca894d9a04f55529e4b7c44dcabe2c1b439a1/lib/optimize/UglifyJsPlugin.js#L16 See webpack@48e17ab#commitcomment-20424582
1 parent ff88513 commit 5f44819

5 files changed

Lines changed: 23 additions & 1 deletion

File tree

bin/convert-argv.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ module.exports = function(yargs, argv, convertOptions) {
227227

228228
function loadPlugin(name) {
229229
var loadUtils = require("loader-utils");
230-
var args = null;
230+
var args;
231231
try {
232232
var p = name && name.indexOf("?");
233233
if(p > -1) {
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = "foo";
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
"use strict";
2+
3+
module.exports = function testAssertions(code, stdout, stderr) {
4+
code.should.be.exactly(0);
5+
6+
stdout.should.be.ok();
7+
stdout[3].should.containEql("Hash: ");
8+
stdout[4].should.containEql("Version: ");
9+
stdout[5].should.containEql("Time: ");
10+
stdout[7].should.containEql("null.js");
11+
stdout[8].should.containEql("./index.js");
12+
stdout[8].should.containEql("[built]");
13+
14+
stderr.should.be.empty();
15+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--plugin webpack/lib/optimize/UglifyJsPlugin
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
var path = require("path");
2+
3+
module.exports = {
4+
entry: path.resolve(__dirname, "./index"),
5+
}

0 commit comments

Comments
 (0)