const htmlWebpackPlugin=require ('html-webpack-plugin' );
plugins:[
new htmnlWebpackPlugin({
template:'index.html' ,
filename:'home.html' ,
title:'webpack' ,
data:'aaaaaa'
})
]
open-browser-webpack-plugin
const OpenBrowserWebpackPlugin=require ('open-browser-webpack-plugin' );
plugins:[
new OpenBrowserWebpackPlugin({url:'http://localhost:8877' })
]
extract-text-webpack-plugin
const ExtractTextPlugin=require ('extract-text-webpack-plugin' );
plugins:[
new ExtractTextPlugin('main.css' )
]
const CopyWebpackPlugin=require('copy-webpack-plugin' );
new CopyWebpackPlugin([{
from : __dirname + '/src/public'
}]);
const WebpackMd5Hash=require ('webpack-md5-hash' );
output: {
//...
chunkFilename: "[name].[chunkhash:6].js"
},
plugins:[
new WebpackMd5Plugin();
]
/// 它的作用是生成具有独立hash值的css和js文件,即css和js文件hash值解耦。webpack-md5-hash插件对chunk-hash钩子进行捕获并重新计算chunkhash,它的计算方法是只计算模块本身的当前内容(包括同步模块)。
const cleanWebpackPlugin=require('clean-webpack-plugin' );
plugins:[
new cleanWebpackPlugin(['./dist' ,'./build' ]);
]
const progressbarWebpack = require('progress-bar-webpack-plugin' );
plugins:[
new progressbarWebpack ();
]