MCPcopy
hub / github.com/webpack/webpack / _chunkHasJs

Function _chunkHasJs

lib/javascript/JavascriptModulesPlugin.js:159–171  ·  view source on GitHub ↗
(chunk, chunkGraph)

Source from the content-addressed store, hash-verified

157 * @returns {boolean} true, when a JS file is needed for this chunk
158 */
159const _chunkHasJs = (chunk, chunkGraph) => {
160 if (chunkGraph.getNumberOfEntryModules(chunk) > 0) {
161 for (const module of chunkGraph.getChunkEntryModulesIterable(chunk)) {
162 if (chunkGraph.getModuleSourceTypes(module).has(JAVASCRIPT_TYPE)) {
163 return true;
164 }
165 }
166 }
167
168 return Boolean(
169 chunkGraph.getChunkModulesIterableBySourceType(chunk, JAVASCRIPT_TYPE)
170 );
171};
172
173/**
174 * Returns true, when a JS file is needed for this chunk.

Callers 1

chunkHasJsFunction · 0.85

Calls 5

getModuleSourceTypesMethod · 0.80
hasMethod · 0.45

Tested by

no test coverage detected