webpack/lib/Entrypoint.js

41 lines
643 B
JavaScript
Raw Normal View History

/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const ChunkGroup = require("./ChunkGroup");
class Entrypoint extends ChunkGroup {
constructor(name) {
super(name);
this.runtimeChunk = undefined;
}
isInitial() {
return true;
2018-01-09 16:40:30 +08:00
}
getFiles() {
2017-11-06 23:41:26 +08:00
const files = new Set();
for(const chunk of this.chunks) {
2018-02-08 07:28:08 +08:00
for(const file of chunk.files) {
files.add(file);
}
}
2017-11-06 23:41:26 +08:00
return Array.from(files);
}
setRuntimeChunk(chunk) {
this.runtimeChunk = chunk;
}
getRuntimeChunk() {
return this.runtimeChunk || this.chunks[0];
}
}
module.exports = Entrypoint;