emersonthis needs to attract extra consideration to this query.
I am utilizing Capacitor to construct a local app utilizing Vue.js.
I can get reside reloading to work within the browser and the ios simulator, utilizing the next configs:
The native dev server needs to be set to the ip: 0.0.0.0. With Vue3/Vite it meant altering the script in bundle.json to…
“scripts”: {
“dev”: “vite –host 0.0.0.0”,
The vite configs must set the server to the ip tackle on the community
import { CapacitorConfig } from ‘@capacitor/cli’;
const config: CapacitorConfig = {
appId: ‘com.instance.my_app’,
appName: ‘My App’,
webDir: ‘dist’,
server: {
androidScheme: ‘https’,
url: ‘http://192.168.x.xx:5173’,
cleartext: true
}
};
export default config;
The Drawback
My present configurations have an annoying drawback! In the event you construct the app with these settings, the app will solely work on the native community together with your dev server operating. You’ll be able to remark out the url: http://… within the configs after which the construct will work usually, however that is annoying and clunky.
How do I get reside reloading to work in improvement, but additionally get the manufacturing construct to work with out having to hack the configs?