2013-01-31 01:49:25 +08:00
|
|
|
/*
|
|
|
|
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
|
|
Author Tobias Koppers @sokra
|
|
|
|
*/
|
|
|
|
function RemoveEmptyChunksPlugin() {
|
|
|
|
}
|
|
|
|
module.exports = RemoveEmptyChunksPlugin;
|
|
|
|
|
|
|
|
RemoveEmptyChunksPlugin.prototype.apply = function(compiler) {
|
|
|
|
compiler.plugin("compilation", function(compilation) {
|
2014-09-23 14:42:54 +08:00
|
|
|
compilation.plugin(["optimize-chunks", "optimize-extracted-chunks"], function(chunks) {
|
2013-01-31 01:49:25 +08:00
|
|
|
chunks.filter(function(chunk) {
|
2013-12-19 18:46:45 +08:00
|
|
|
return chunk.isEmpty() && !chunk.initial;
|
2013-01-31 01:49:25 +08:00
|
|
|
}).forEach(function(chunk) {
|
|
|
|
chunk.remove("empty");
|
|
|
|
chunks.splice(chunks.indexOf(chunk), 1);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|