capacitor
capacitor copied to clipboard
bug: Error reporting when opening agent in vite project
Bug Report
Hello, my English is not good. I'm using translation software. I try to configure the agent in vite + vue3 project to solve the cross domain problem of Axios. After I configure it, the browser works normally, but the console throws an error when running on the Android device. At present, I can't solve it. What's the solution?
Capacitor Version
Latest Dependencies:
@capacitor/cli: 3.4.1
@capacitor/core: 3.4.1
@capacitor/android: 3.4.1
@capacitor/ios: 3.4.1
Installed Dependencies:
@capacitor/ios: not installed
@capacitor/core: 3.4.1
@capacitor/cli: 3.4.1
@capacitor/android: 3.4.1
Platform(s)
vue: ^3.2.25 vite: ^2.7.2 axios: ^0.26.0 android: 11
Current Behavior
Expected Behavior
Code Reproduction
Other Technical Details
npm --version
output: 7.10.0
node --version
output: v16.0.0
pod --version
output (iOS issues only):
Additional Context
// vite.config.js
export default defineConfig({
server: {
host: "localhost",
// port: 8080,
open: true,
cors: true,
proxy: {
'^/api': {
target: 'https://xxx.xxx.xxx/',
changeOrigin: true,
ws: true,
rewrite: (path) => path.replace(/^\/api/, '')
}
}
},
});
I'm not sure if Capacitor support Vite at this moment!
This issue may need more information before it can be addressed. In particular, it will need a reliable Code Reproduction that demonstrates the issue.
Please see the Contributing Guide for how to create a Code Reproduction.
Thanks! Ionitron 💙
It looks like this issue didn't get the information it needed, so I'll close it for now. If I made a mistake, sorry! I am just a bot.
Have a great day! Ionitron 💙
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.