Merge pull request #3384 from uncleyo/exclude-with-loader

Unhide own modules when loader path matches exclude filter
This commit is contained in:
Tobias Koppers 2016-11-28 16:13:46 +01:00 committed by GitHub
commit c356619bbe
6 changed files with 31 additions and 1 deletions

View File

@ -64,7 +64,7 @@ Stats.prototype.toJson = function toJson(options, forToString) {
}
if(excludeModules.length === 0)
return true;
var ident = module.identifier();
var ident = module.resource;
return !excludeModules.some(function(regExp) {
return regExp.test(ident);
});

View File

@ -0,0 +1 @@
module.exports = "a"

View File

@ -0,0 +1 @@
module.exports = "b"

View File

@ -0,0 +1,8 @@
Hash: affacd3db222d3fcb700
Time: Xms
Asset Size Chunks Chunk Names
bundle.js 2.69 kB 0 [emitted] main
chunk {0} bundle.js (main) 132 bytes [entry] [rendered]
[0] (webpack)/test/statsCases/exclude-with-loader/a.txt 43 bytes {0} [built]
[2] (webpack)/test/statsCases/exclude-with-loader/index.js 46 bytes {0} [built]
+ 1 hidden modules

View File

@ -0,0 +1,2 @@
require("./a.txt")
require("./exclude/b.txt")

View File

@ -0,0 +1,18 @@
module.exports = {
entry: "./index",
output: {
filename: "bundle.js"
},
stats: {
exclude: [
"node_modules",
"exclude"
]
},
module: {
loaders: [{
test: /\.txt/,
loader: "raw-loader"
}]
}
};