MCPcopy
hub / github.com/webpack/webpack / chunkHasJs

Function chunkHasJs

lib/dependencies/HtmlEntryDependency.js:232–244  ·  view source on GitHub ↗
(chunk, chunkGraph)

Source from the content-addressed store, hash-verified

230 * @returns {boolean} true if the chunk emits a `.js` file
231 */
232const chunkHasJs = (chunk, chunkGraph) => {
233 if (chunk.hasRuntime()) return true;
234 if (chunkGraph.getNumberOfEntryModules(chunk) > 0) {
235 for (const module of chunkGraph.getChunkEntryModulesIterable(chunk)) {
236 if (chunkGraph.getModuleSourceTypes(module).has(JAVASCRIPT_TYPE)) {
237 return true;
238 }
239 }
240 }
241 return Boolean(
242 chunkGraph.getChunkModulesIterableBySourceType(chunk, JAVASCRIPT_TYPE)
243 );
244};
245
246/**
247 * Whether webpack will emit a `.css` file for this chunk that must be

Callers 2

applyMethod · 0.70
withDependentChunksMethod · 0.50

Calls 6

hasRuntimeMethod · 0.80
getModuleSourceTypesMethod · 0.80
hasMethod · 0.45

Tested by

no test coverage detected