zoukankan      html  css  js  c++  java
  • webpack的ProgressPlugin

    webpack的支持多种hook,每次编译,各个hook阶段都会执行一次。

    ProgressPlugin可以监控各个hook执行的进度percentage,输出各个hook的名称和描述。

    • percentage: a number between 0 and 1 indicating the completion percentage of the compilation
    • message: a short description of the currently-executing hook
    • ...args: zero or more additional strings describing the current progress
    const handler = (percentage, message, ...args) => {
      // e.g. Output each progress message directly to the console:
      console.info(percentage, message, ...args);
    };
    
    new webpack.ProgressPlugin(handler);

    各个hook的进度如下图

    可以在不同的hook执行完毕,或在一次编译完成后,执行一些额外的操作,例如移动一些文件等。

    new webpack.ProgressPlugin((percentage, message, ...args) => {
           if(percentage == 1){
                console.info(percentage, message, ...args);
                //copy files
           }
    })

     具体可参考: ProgressPlugin

  • 相关阅读:
    uva1220--树的最大独立集+判重
    UVA12186--树型DP
    HDU4171--bfs+树
    远程调用
    高并发业务
    wireshark
    将java程序打包成exe文件
    将博客搬至CSDN
    Mysql分区
    MogileFS
  • 原文地址:https://www.cnblogs.com/mengff/p/12847021.html
Copyright © 2011-2022 走看看