add origin for used named chunks
This commit is contained in:
parent
228486cfbe
commit
89fb178917
|
@ -68,6 +68,10 @@ Chunk.prototype.addBlock = function(block) {
|
|||
return true;
|
||||
};
|
||||
|
||||
Chunk.prototype.addOrigin = function(module, loc) {
|
||||
this.origins.push({module: module, loc: loc, name: this.name});
|
||||
};
|
||||
|
||||
Chunk.prototype.remove = function(reason) {
|
||||
// console.log("remove " + this.toString());
|
||||
this.modules.slice().forEach(function(m) {
|
||||
|
|
|
@ -410,8 +410,11 @@ Compilation.prototype.seal = function seal(callback) {
|
|||
|
||||
Compilation.prototype.addChunk = function addChunk(name, module, loc) {
|
||||
if(name) {
|
||||
if(Object.prototype.hasOwnProperty.call(this.namedChunks, name))
|
||||
return this.namedChunks[name];
|
||||
if(Object.prototype.hasOwnProperty.call(this.namedChunks, name)) {
|
||||
var chunk = this.namedChunks[name];
|
||||
if(module) chunk.addOrigin(module, loc);
|
||||
return chunk;
|
||||
}
|
||||
}
|
||||
var chunk = new Chunk(name, module, loc);
|
||||
this.chunks.push(chunk);
|
||||
|
|
Loading…
Reference in New Issue