webpack之模块热替换与热加载
模块热替换功能会在应用程序运行过程中,替换、添加或删除模块,而无需重新加载整个页面
const HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
mode:'development',
entry:'./app.js',
module: {
rules:[
{
test:'/\.css$/',
use:['style-loader','css-loader']
}
]
},
plugin: [
new HtmlWebpackPlugin()
],
//时时进行更新和替换
devServer: {
hot: true,
liveReload: true
}
}