MCPcopy
hub / github.com/webpack/webpack / checkConstraints

Method checkConstraints

lib/Compilation.js:6202–6240  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6200 }
6201
6202 checkConstraints() {
6203 const chunkGraph = this.chunkGraph;
6204
6205 /** @type {Set<ModuleId>} */
6206 const usedIds = new Set();
6207
6208 for (const module of this.modules) {
6209 if (module.type === WEBPACK_MODULE_TYPE_RUNTIME) continue;
6210 const moduleId = chunkGraph.getModuleId(module);
6211 if (moduleId === null) continue;
6212 if (usedIds.has(moduleId)) {
6213 throw new Error(`checkConstraints: duplicate module id ${moduleId}`);
6214 }
6215 usedIds.add(moduleId);
6216 }
6217
6218 for (const chunk of this.chunks) {
6219 for (const module of chunkGraph.getChunkModulesIterable(chunk)) {
6220 if (!this.modules.has(module)) {
6221 throw new Error(
6222 "checkConstraints: module in chunk but not in compilation " +
6223 ` ${chunk.debugId} ${module.debugId}`
6224 );
6225 }
6226 }
6227 for (const module of chunkGraph.getChunkEntryModulesIterable(chunk)) {
6228 if (!this.modules.has(module)) {
6229 throw new Error(
6230 "checkConstraints: entry module in chunk but not in compilation " +
6231 ` ${chunk.debugId} ${module.debugId}`
6232 );
6233 }
6234 }
6235 }
6236
6237 for (const chunkGroup of this.chunkGroups) {
6238 chunkGroup.checkConstraints();
6239 }
6240 }
6241}
6242
6243/**

Callers

nothing calls this directly

Calls 5

getModuleIdMethod · 0.80
hasMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected