1.npm run dev后,修改项目文件后, 没有自动更新编译,需要手动再执行npm run dev。
2.自动打开的浏览器内容不会自动更新。
问题解决:
1.config/index.js 修改dev中poll选项值为true(或时间)。
const path = require('path')
module.exports = {
dev: {
// Paths
assetsSubDirectory: 'static',
assetsPublicPath: '/',
proxyTable: {},
// Various Dev Server settings
host: 'localhost', // can be overwritten by process.env.HOST
port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
autoOpenBrowser: true,
errorOverlay: true,
notifyOnErrors: true,
poll: true, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
2.build/webpack.dev.conf.js 修改devServer中hot选项值为true。
devServer: {
clientLogLevel: 'warning',
historyApiFallback: {
rewrites: [
{ from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') },
],
},
hot: true,
contentBase: false, // since we use CopyWebpackPlugin.
参考
https://blog.csdn.net/u010419337/article/details/79072456