Skip to content

Commit

Permalink
refactor: add type annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
FogelAI committed Mar 12, 2024
1 parent c10b21b commit 6451833
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,12 @@ class MiniCssExtractPlugin {

return obj;
};
// @ts-ignore

/**
* @param {Chunk} chunk chunk
* @param {ChunkGraph} chunkGraph chunk graph
* @returns {boolean} true, when the chunk has css
*/
function chunkHasCss(chunk, chunkGraph) {
// this function replace:
// const chunkHasCss = require("webpack/lib/css/CssModulesPlugin").chunkHasCss;
Expand Down Expand Up @@ -884,13 +889,12 @@ class MiniCssExtractPlugin {
/** @type {Chunk} */ (chunk),
/** @type {Compilation} */ (this.compilation)
);
const globalObject = runtimeTemplate.globalObject;
const { globalObject } = runtimeTemplate;
const { linkPreload, linkPrefetch } =
JsonpChunkLoadingRuntimeModule.getCompilationHooks(compilation);
const conditionMap = chunkGraph.getChunkConditionMap(
chunk,
chunkHasCss
);
const conditionMap = /** @type {ChunkGraph} */ (
chunkGraph
).getChunkConditionMap(/** @type {Chunk} */ (chunk), chunkHasCss);
const hasCssMatcher = compileBooleanMatcher(conditionMap);

const withLoading =
Expand Down

0 comments on commit 6451833

Please sign in to comment.