import { defineConfig } from 'vite';
import uni from '@dcloudio/vite-plugin-uni';
export default defineConfig({
plugins: [uni()],
server: {
port:3000,
proxy: {
"/api": {
target: "http://127.0.0.1:8080", // 代理地址
changeOrigin: true,
ws: true,
pathRewrite: {
"^/api": "" // 将/api重写为空,请求到代理服务的路径就为target的路径
}
}
}
}
});
error:
TypeError: Failed to fetch dynamically imported module: http://localhost:3000/pages/index/index.vue at @fs/Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli-vite/node_modules/@dcloudio/uni-h5-vue/dist/vue.runtime.esm.js:1442
请问如何处理?去掉server后正常,加上就不行