MCPcopy
hub / github.com/webpack/webpack / needBuild

Method needBuild

lib/ContextModule.js:451–465  ·  lib/ContextModule.js::ContextModule.needBuild

* Checks whether the module needs to be rebuilt for the current build state. * @param {NeedBuildContext} context context info * @param {NeedBuildCallback} callback callback function, returns true, if the module needs a rebuild * @returns {void}

({ fileSystemInfo }, callback)

Source from the content-addressed store, hash-verified

449 * @returns {void}
450 */
451 needBuild({ fileSystemInfo }, callback) {
452 class="cm">// build if enforced
453 if (this._forceBuild) return callback(null, true);
454
455 const buildInfo = /** @type {ContextModuleBuildInfo} */ (this.buildInfo);
456
457 class="cm">// always build when we have no snapshot and context
458 if (!buildInfo.snapshot) {
459 return callback(null, Boolean(this.context || this.options.resource));
460 }
461
462 fileSystemInfo.checkSnapshotValid(buildInfo.snapshot, (err, valid) => {
463 callback(err, !valid);
464 });
465 }
466
467 /**
468 * Builds the module using the provided compilation context.

Callers

nothing calls this directly

Calls 2

checkSnapshotValidMethod · 0.80
callbackFunction · 0.50

Tested by

no test coverage detected