修改js浏览器可以刷新,但是修改模板页面浏览器不会刷新,请问该怎么配置?
webpcak.config.js如下
const path = require('path')
const webpack = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
entry: {
'index': './index.js'
},
output: {
filename: 'bundle.js',
path: path.resolve('./', 'dist')
},
module: {
rules: [{
test: /\.js$/,
use: [{
loader: 'babel-loader',
options: {
presets: ['es2015']
}
}],
exclude: path.resolve('./', 'node_modules/')
}]
},
devServer: {
proxy: {
},
historyApiFallback: true,
hot: true,
inline: true,
contentBase: './dist'
},
plugins: [
new HtmlWebpackPlugin({
template: './index.html',
chunks: ['index']
}),
new webpack.HotModuleReplacementPlugin()
]
}
devServer的contentBase设置成./dist 是什么意思?
一般都是
contentBase: './src',