项目更改代码保存后热更新页面,出现ws报错,看终端出现以下报错,求解决
node:internal/process/promises:279
triggerUncaughtException(err, true /* fromPromise */);
^
[Error: ENOENT: no such file or directory, open '/Users/mac/Desktop/work/yuanchuangshenghuo20220509/liveproject/node_modules/.stats-serve.json'] {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '/Users/mac/Desktop/work/yuanchuangshenghuo20220509/liveproject/node_modules/.stats-serve.json'
}
排查了一下,由于项目全局引入了vant框架,全局引入css文件就会在下次热更新时报错,不引入就不报错
const { defineConfig } = require('@vue/cli-service')
module.exports = {
// 开发环境
devServer: {
port: '8080',
host: 'localhost',
https: false,
open: true,
proxy: {//开发环境代理配置
// '/dev-api':{
[process.env.VUE_APP_BASE_API]: {
//目标服务器地址
target: process.env.VUE_APP_SERVICE_URL,
changOrigin: true,//开启代理服务器
pathRewrite: {
['^' + process.env.VUE_APP_BASE_API]: ''
},
ws: false // 修改这里
},
"/": {
changOrigin: true,//开启代理服务器
ws: false // 修改这里
}
}
},
transpileDependencies: true,
configureWebpack: {
watch: true,
watchOptions: {
ignored: ['/.#*.vue', 'node_modules/']
},
},
lintOnSave: false,
productionSourceMap: false,
chainWebpack: config => {
config
.plugin('html')
.tap(args => {
args[0].title = '源创生活'
return args;
})
}
}
检查一下这个文件的路径对不对?stats-serve.json