feat: refactoring project
This commit is contained in:
9
node_modules/webpack/lib/ids/SyncModuleIdsPlugin.js
generated
vendored
9
node_modules/webpack/lib/ids/SyncModuleIdsPlugin.js
generated
vendored
@@ -10,6 +10,7 @@ const { getUsedModuleIdsAndModules } = require("./IdHelpers");
|
||||
|
||||
/** @typedef {import("../Compiler")} Compiler */
|
||||
/** @typedef {import("../Module")} Module */
|
||||
/** @typedef {import("../util/fs").IntermediateFileSystem} IntermediateFileSystem */
|
||||
|
||||
const plugin = "SyncModuleIdsPlugin";
|
||||
|
||||
@@ -42,7 +43,9 @@ class SyncModuleIdsPlugin {
|
||||
let dataChanged = false;
|
||||
if (this._read) {
|
||||
compiler.hooks.readRecords.tapAsync(plugin, callback => {
|
||||
const fs = compiler.intermediateFileSystem;
|
||||
const fs =
|
||||
/** @type {IntermediateFileSystem} */
|
||||
(compiler.intermediateFileSystem);
|
||||
fs.readFile(this._path, (err, buffer) => {
|
||||
if (err) {
|
||||
if (err.code !== "ENOENT") {
|
||||
@@ -69,7 +72,9 @@ class SyncModuleIdsPlugin {
|
||||
for (const [key, value] of sorted) {
|
||||
json[key] = value;
|
||||
}
|
||||
const fs = compiler.intermediateFileSystem;
|
||||
const fs =
|
||||
/** @type {IntermediateFileSystem} */
|
||||
(compiler.intermediateFileSystem);
|
||||
fs.writeFile(this._path, JSON.stringify(json), callback);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user