webpack/test/configCases/plugins/progress-plugin/webpack.config.js

25 lines
681 B
JavaScript
Raw Normal View History

2019-05-22 21:54:44 +08:00
const path = require("path");
const webpack = require("../../../../");
const data = require("./data");
/** @type {import("../../../../").Configuration} */
2017-12-13 17:08:58 +08:00
module.exports = {
externals: {
2019-05-22 21:54:44 +08:00
data: "commonjs " + path.resolve(__dirname, "data.js")
2017-12-13 17:08:58 +08:00
},
plugins: [
new webpack.ProgressPlugin((value, ...messages) => {
data.push(messages.join("|"));
}),
{
2018-02-25 09:00:20 +08:00
apply: compiler => {
2017-12-13 17:08:58 +08:00
compiler.hooks.compilation.tap("CustomPlugin", compilation => {
2019-02-19 15:58:46 +08:00
compilation.hooks.optimize.tap("CustomPlugin", () => {
const reportProgress = webpack.ProgressPlugin.getReporter(compiler);
reportProgress(0, "custom category", "custom message");
});
2017-12-13 17:08:58 +08:00
});
}
}
]
};