webpack-11-小插件

webpack小插件

  1. clean-webpack-plugin 可清除原打包文件

    1
    2
    3
    4
    5
    6
    7
    8
    const { CleanWebpackPlugin } = require('clean-webpack-plugin')
    const webpackConfig = {
    plugins: [
    new CleanWebpackPlugin(),
    ],
    };

    module.exports = webpackConfig;
  2. copy-webpack-plugin 可拷贝文件

    1
    2
    3
    new CopyWebpackPlugin([ 
    {from: 'src', to: './'}
    ])
  3. BannerPlugin 在打包的文件开始处添加信息(webpack内置)

    1
    2
    const webpack = require('webpack')
    new webpack.BannerPlugin('make by csr hhh')
0%