有时,在运行webpack的手表模式和编辑源文件时,我不确定webpack是否已经打包了我的更改。
在webpack每次更新捆绑包时,有没有办法将时间戳打印到控制台?
发布于 2017-03-16 05:59:15
您可以添加如下自定义插件:
config.plugins.push(new function() {
this.apply = (compiler) => {
compiler.hooks.done.tap("Log On Done Plugin", () => {
console.log(("\n[" + new Date().toLocaleString() + "]") + " Begin a new compilation.\n");
});
};
});发布于 2018-10-26 15:20:16
datou3600的答案很棒,但是为什么不做得更好呢?
增加一点延迟:
以下是代码:
config.plugins.push(function(){
this.plugin('done', function(stats) {
setTimeout(
() => {
console.log(('\n[' + new Date().toLocaleString() + ']') + ' --- DONE.\n');
},
100
);
});
});发布于 2017-01-19 11:29:44
https://stackoverflow.com/questions/41704664
复制相似问题