提取文件

使用extract-text-webpack-plugin来进行将包提取为文件。

安装

$ npm i extract-text-webpack-plugin -D

webpack.config.js

const ExtractTextPlugin = require('extract-text-webpack-plugin');


module.exports = {
  plugins: [
    new ExtractTextPlugin({
      filename: `[name]_[contenthash:8].css`,// 给输出的 CSS 文件名称加上 Hash 值
    }),
  ],
};

Last updated