vue2 老项目中使用history模式本地开发刷新白屏

30 阅读1分钟

1、路由中 mode:history

image.png

2、去掉html中的链接方式,改为在main.js中引入

3、在webpack中注释掉

image.png

注释掉有些页面用了Vue没有引入会报错 解决方案 import Vue from 'vue'

4、webpack配置

在devServe 的 proxy中配置请求代理的时候使用 bypass

文档链接 webpack.docschina.org/configurati…

Vue Router文档链接 v3.router.vuejs.org/guide/essen…

image.png