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

28 lines
601 B
JavaScript
Raw Normal View History

2017-12-13 17:08:58 +08:00
var webpack = require("../../../../");
var data = require("./data");
module.exports = {
externals: {
[__dirname + "/data"]: "commonjs " + __dirname + "/data"
},
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 => {
2018-02-25 09:00:20 +08:00
compilation.hooks.optimize.tap(
{
name: "CustomPlugin",
context: true
},
context => {
context.reportProgress(0, "custom category", "custom message");
}
);
2017-12-13 17:08:58 +08:00
});
}
}
]
};