mirror of https://github.com/webpack/webpack.git
fix: lint
This commit is contained in:
parent
81268133cd
commit
a51d2349ee
|
@ -3,20 +3,25 @@
|
||||||
const { RawSource } = require("webpack-sources");
|
const { RawSource } = require("webpack-sources");
|
||||||
const webpack = require("../../../../");
|
const webpack = require("../../../../");
|
||||||
|
|
||||||
|
/** @typedef {import("../../../../lib/Compiler")} Compiler */
|
||||||
|
|
||||||
class CopyPlugin {
|
class CopyPlugin {
|
||||||
|
/**
|
||||||
|
* Apply the plugin
|
||||||
|
* @param {Compiler} compiler the compiler instance
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
apply(compiler) {
|
apply(compiler) {
|
||||||
const hookOptions = {
|
const hookOptions = {
|
||||||
name: "MockCopyPlugin",
|
name: "MockCopyPlugin",
|
||||||
stage: webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS
|
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) => {
|
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));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue