-
Notifications
You must be signed in to change notification settings - Fork 6
vue-cli4 热更新失效无法自动刷新的问题 #51
Copy link
Copy link
Open
Description
devServe配置没毛病,但就是没法热更新
// devServe配置没毛病
return {
disableHostCheck: true,
open: false,
host: '0.0.0.0',
port: ENV.VUE_APP_PORT,
https: false,
hotOnly: true,
clientLogLevel: 'warn',
overlay: {
warnings: true,
errors: true,
},
before: (app) => {
VUE_APP_USE_MOCK === 'TRUE' && app.use(mockMiddleware());
},
historyApiFallback: {
rewrites: [
{
from: /.*/,
to: path.posix.join('/', 'index.html'),
},
],
},解决方法:config.resolve.symlinks(true);
chainWebpack: config => {
// 修复HMR
config.resolve.symlinks(true);
// config.plugins.delete('preload');
// config.plugins.delete('prefetch');
config
.plugin("ignore")
.use(
new webpack.ContextReplacementPlugin(/moment[/\\]locale$/, /zh-cn$/)
);
// 添加别名
config.resolve.alias
....vue.config.js其它配置可以参考,全面配置
Reactions are currently unavailable