Skip to content

Commit fe67901

Browse files
authored
Merge pull request webpack#3303 from webpack/bugfix/cli
`--module-bind` automatically appends `-loader`
2 parents 4e73265 + 712a914 commit fe67901

4 files changed

Lines changed: 8 additions & 7 deletions

File tree

bin/convert-argv.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ module.exports = function(yargs, argv, convertOptions) {
296296
ifArgPair(arg, function(name, binding) {
297297
if(name === null) {
298298
name = binding;
299+
binding += "-loader";
299300
}
300301
options.module[collection].push({
301302
test: new RegExp("\\." + name.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&") + "$"),

test/browsertest/build.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ var library1 = cp.spawn("node", join(["../../bin/webpack.js", "--output-pathinfo
3434
bindOutput(library1);
3535
library1.on("exit", function(code) {
3636
if(code === 0) {
37-
// node ../../bin/webpack --output-pathinfo --color --resolve-alias vm=vm-browserify --output-public-path js/ --output-chunk-filename [name].web.js --module-bind json --module-bind css=style!css --module-bind less=style!css!less --module-bind coffee --module-bind jade --prefetch ./lib/stylesheet.less ./lib/index "js/web.js?h=[hash]"
37+
// node ../../bin/webpack --output-pathinfo --color --resolve-alias vm=vm-browserify --output-public-path js/ --output-chunk-filename [name].web.js --module-bind json --module-bind css=style!css --module-bind less=style-loader!css-loader!less-loader --module-bind coffee --module-bind jade --prefetch ./lib/stylesheet.less ./lib/index "js/web.js?h=[hash]"
3838
var main = cp.spawn("node", join(["../../bin/webpack.js", "--output-pathinfo", "--color", "--resolve-alias", "vm=vm-browserify",
3939
"--output-public-path", "js/", "--output-chunk-filename", "[name].web.js",
40-
"--module-bind", "json", "--module-bind", "css=style!css", "--module-bind", "less=style/url!file?postfix=.css&string!less", "--module-bind", "coffee", "--module-bind", "jade", "--prefetch", "./lib/stylesheet.less", "./lib/index", "js/web.js?h=[hash]", "--progress"], extraArgs));
40+
"--module-bind", "json", "--module-bind", "css=style-loader!css-loader", "--module-bind", "less=style-loader/url!file-loader?postfix=.css&string!less-loader", "--module-bind", "coffee", "--module-bind", "jade", "--prefetch", "./lib/stylesheet.less", "./lib/index", "js/web.js?h=[hash]", "--progress"], extraArgs));
4141
bindOutput(main);
4242
}
4343
});

test/browsertest/lib/index.web.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function test(cond, message) {
99
}
1010

1111
// load tests from library1, with script loader
12-
require("script!../js/library1.js");
12+
require("script-loader!../js/library1.js");
1313

1414
// Buildin 'style' loader adds css to document
1515
require("./stylesheet.css");
@@ -32,7 +32,7 @@ describe("main", function() {
3232
should.exist(window.library2.ok);
3333
window.library2.ok.should.be.eql(true);
3434
});
35-
35+
3636
describe("web resolving", function() {
3737
it("should load index.web.js instead of index.js", function() {
3838
true.should.be.eql(true);
@@ -87,8 +87,8 @@ describe("main", function() {
8787

8888
describe("web loaders", function() {
8989
it("should handle the file loader correctly", function() {
90-
require("!file!../img/image.png").should.match(/js\/.+\.png$/);
91-
document.getElementById("image").src = require("file?prefix=img/!../img/image.png");
90+
require("!file-loader!../img/image.png").should.match(/js\/.+\.png$/);
91+
document.getElementById("image").src = require("file-loader?prefix=img/!../img/image.png");
9292
});
9393
});
9494

test/browsertest/library2config.coffee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ exports.default = new Promise (resolve, reject) ->
88
hashDigestLength: 5
99
module:
1010
rules: [
11-
{ test: /extra2?\.js/, loader: "raw!./node_modules/extra.loader.js!val?cacheable", enforce: "post" }
11+
{ test: /extra2?\.js/, loader: "raw-loader!./node_modules/extra.loader.js!val-loader?cacheable", enforce: "post" }
1212
]
1313
amd:
1414
fromOptions: true

0 commit comments

Comments
 (0)