Skip to content

Commit

Permalink
fix: logic
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Nov 13, 2024
1 parent 16719ec commit 73ef2eb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 20 deletions.
34 changes: 14 additions & 20 deletions lib/dependencies/PureExpressionDependency.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,28 +69,22 @@ class PureExpressionDependency extends NullDependency {
* @returns {void}
*/
updateHash(hash, context) {
if (this._hashUpdate === undefined) {
const runtimeCondition = this._getRuntimeCondition(
context.chunkGraph.moduleGraph,
context.runtime
);

if (runtimeCondition === true) {
this._hashUpdate = false;
} else if (runtimeCondition === false) {
this._hashUpdate = `null${String(this.range)}`;
} else {
this._hashUpdate = `${runtimeToString(runtimeCondition)}|${runtimeToString(
context.runtime
)}${String(this.range)}`;
}
}

if (this._hashUpdate === false) {
const runtimeCondition = this._getRuntimeCondition(
context.chunkGraph.moduleGraph,
context.runtime
);
if (runtimeCondition === true) {
return;
} else if (runtimeCondition === false) {
hash.update("null");
} else {
hash.update(
`${runtimeToString(runtimeCondition)}|${runtimeToString(
context.runtime
)}`
);
}

hash.update(this._hashUpdate);
hash.update(String(this.range));
}

/**
Expand Down
1 change: 1 addition & 0 deletions types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7505,6 +7505,7 @@ declare interface KnownBuildMeta {
strictHarmonyModule?: boolean;
async?: boolean;
sideEffectFree?: boolean;
exportsFinalName?: Record<string, string>;
}
declare interface KnownCreateStatsOptionsContext {
forToString?: boolean;
Expand Down

0 comments on commit 73ef2eb

Please sign in to comment.