mirror of https://github.com/webpack/webpack.git
added test case for loader chaining (#3746)
This commit is contained in:
parent
b7c1b5c672
commit
5b0a16cea3
|
|
@ -0,0 +1 @@
|
||||||
|
module.exports = ["abc"];
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
module.exports = ["def"];
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
it("should match rule with multiple loaders in 'loader'", function() {
|
||||||
|
var abc = require("./abc");
|
||||||
|
abc.should.be.eql([
|
||||||
|
"abc",
|
||||||
|
"?b",
|
||||||
|
"?a"
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
it("should match rule with multiple loaders in 'loaders'", function() {
|
||||||
|
var def = require("./def");
|
||||||
|
def.should.be.eql([
|
||||||
|
"def",
|
||||||
|
"?d",
|
||||||
|
"?c"
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
module.exports = function(source) {
|
||||||
|
var query = this.query;
|
||||||
|
if(typeof query === "object" && typeof query.get === "function") {
|
||||||
|
query = query.get();
|
||||||
|
}
|
||||||
|
return source + "\nmodule.exports.push(" + JSON.stringify(query) + ");";
|
||||||
|
};
|
||||||
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
module.exports = {
|
||||||
|
module: {
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
resource: /abc\.js$/,
|
||||||
|
loader: "./loader?a!./loader?b"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
resource: /def\.js$/,
|
||||||
|
loaders: "./loader?c!./loader?d"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue