ionic-capacitor-react-vite-app
This template should help get you started developing with React Ionic and Capacitor using Vite.
Updated 8/11/22
Getting Live Reload To Work In You Vite Ionic Project
I dont use Live reload that often, but this is a manual approach to get it going with the Vite project
First Start Your Server
aaronksaunders@Aarons-14MacBookProM1Pro my-react-app % npm run dev
> my-react-app@0.0.0 dev
> vite
VITE v3.0.6 ready in 359 ms
➜ Local: http://127.0.0.1:5173/
➜ Network: use --host to expose
12:57:47 AM [vite] hmr update /src/App.tsx
Then modify capacitor.config.ts
using the address the server is running on from the command above
const config: CapacitorConfig = {
appId: 'my.react.app',
appName: 'my-react-app',
webDir: 'dist',
bundledWebRuntime: false,
server : {
"url" : "http://127.0.0.1:5173/" //<= use address the server is running on locally
}
};
And finally deploy your app to the device
aaronksaunders@Aarons-14MacBookProM1Pro my-react-app % npx cap run ios --external --target=73CE91C9-4855-496B-9481-CA486652E9D7
✔ Copying web
…