是否可以在 webpack 构建期间记录进度?

Dav*_*erg 7 javascript node.js webpack

当我运行 linting 时,如果出现问题,我会收到错误,否则我不会收到执行 linting 的通知。是否可以在执行插件或加载程序后添加日志消息?

在我的特定情况下,我想在“StyleLintPlugin”插件和“tslint”加载器之后添加日志消息。请参阅下面的 Webpack 配置。

import path from 'path';
import StyleLintPlugin from 'stylelint-webpack-plugin';

module.exports = {
  entry: path.resolve(__dirname, "js/index"),
  output: {
    filename: "bundle.js",
    path: path.resolve(__dirname, "build"),
    publicPath: '/'
  },
  target: 'web',
  watch: true, //Rebuild when file is changed
  devtool: 'source-map', //Let us debug the code without being modified
  resolve: {
    extensions: ['', '.webpack.js', '.web.js', '.ts', '.js', '.css', '.scss']
  },
  plugins: [
    //Used to lint sass files
    new StyleLintPlugin({
      configFile: '.stylelintrc',
      context: undefined,
      files: ['**/*.s?(a|c)ss'],
      failOnError: true,
      quiet: false
    }),
  ],
  module: {
    preLoaders: [
      {
        test: /\.ts$/,
        exclude: /node_modeules/,
        loader: 'tslint'
      }
    ],
    loaders: [
      { 
        test: /\.ts(x?)$/,
        exclude: /node_modeules/,
        loader: 'babel-loader!ts-loader'
      },
      {
        test: /\.css$/,
        exclude: /node_modeules/,
        loader: "style-loader!css-loader"
      },
      {
        test: /\.scss$/,
        exclude: /node_modeules/,
        loader: "style-loader!css-loader!sass-loader"
      }
    ],
  },
  tslint: {
    emitErrors: true,
    failOnHint: true
  }
}
Run Code Online (Sandbox Code Playgroud)