MCPcopy Index your code
hub / github.com/developit/optimize-plugin / updateChunkHash

Method updateChunkHash

src/index.js:452–465  ·  view source on GitHub ↗
(compilation)

Source from the content-addressed store, hash-verified

450
451 // modify chunkHash (webpack 4 & 5)
452 updateChunkHash (compilation) {
453 const updateWithHash = (chunk, hash) => {
454 hash.update(NAME);
455 hash.update(this.serializeOptions());
456 };
457
458 if (this.isWebpack4()) {
459 compilation.mainTemplate.hooks.hashForChunk.tap(NAME, updateWithHash.bind(null, null));
460 compilation.chunkTemplate.hooks.hashForChunk.tap(NAME, updateWithHash.bind(null, null));
461 } else {
462 // @ts-ignore
463 this.webpack.javascript.JavascriptModulesPlugin.getCompilationHooks(compilation).chunkHash.tap(NAME, updateWithHash);
464 }
465 }
466
467 apply (compiler) {
468 this.workerPool = new WorkerPool({

Callers 1

applyMethod · 0.95

Calls 1

isWebpack4Method · 0.95

Tested by

no test coverage detected