manifest.json设置VUE版本3
根目录新建vite.config.js文件
import { defineConfig } from 'vite'
export default defineConfig({
server: {
port : 3001,
proxy: {
'/api': {
target: 'http://jsonplaceholder.typicode.com',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '')
},
}
}
})
运行时报错
10:26:32.866 正在编译中...
10:26:33.062 Port 3000 is in use, trying another one...
10:26:33.064 vite v2.9.5 dev server running at:
10:26:33.065 > Local: http://localhost:3001/
10:26:33.067 > Network: use `--host` to expose
10:26:33.072 ready in 811ms.
10:26:33.117 The following dependencies are imported but could not be resolved:
10:26:33.119 vue (imported by E:/flx-code/uni-app-sxrd/main.js)
10:26:33.121 vuex (imported by E:/flx-code/uni-app-sxrd/store/index.js)
10:26:33.125 Are they installed?
大佬们,我是不是用错了,怎么解决啊
尝试:直接npm i安装 vue和vuex这个报错没了,但是App.vue就不能用了...
zhaoyu2020
原来vue2 ,manifest中设置反代理是正常获取api的 , 改成vue3 就报404了?需要特殊设置吗?
2023-02-23 11:01