fix: lint

This commit is contained in:
Hai 2025-09-15 00:44:05 +08:00
parent 81268133cd
commit a51d2349ee
1 changed files with 11 additions and 6 deletions

View File

@ -3,20 +3,25 @@
const { RawSource } = require("webpack-sources");
const webpack = require("../../../../");
/** @typedef {import("../../../../lib/Compiler")} Compiler */
class CopyPlugin {
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler) {
const hookOptions = {
name: "MockCopyPlugin",
stage: webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS
};
const emit = (compilation, callback) => {
const output = "// some compilation result\n";
compilation.emitAsset("third.party.js", new RawSource(output));
callback && callback(); // eslint-disable-line no-unused-expressions
};
compiler.hooks.thisCompilation.tap(hookOptions, (compilation) => {
compilation.hooks.processAssets.tap(hookOptions, () => emit(compilation));
compilation.hooks.processAssets.tap(hookOptions, () => {
const output = "// some compilation result\n";
compilation.emitAsset("third.party.js", new RawSource(output));
});
});
}
}