Capacitor 3 live reload with capacitor.config.ts not working
See original GitHub issueDescription:
Ionic and Capacitor have built-in support for live reload: https://capacitorjs.com/docs/v3/guides/live-reload#using-with-ionic-cli. The live reload functionality leverages the capacitor.config.json
file to set the server
parameter, so that the Android and iOS builds know which server to use for live reload.
Capacitor v3 (currently in beta) adds support for a TypeScript configuration file (capacitor.config.ts
). However, Ionic has capacitor.config.json
hardcoded in two places:
Because of this, even if a .ts
config file is present, Ionic will write the server parameters to a newly created capacitor.config.json
, because of which the config never reaches the android
and ios
folders. Capacitor prefers the .ts
file and therefore doesn’t look for a .json
file anymore.
Steps to Reproduce:
- Install Capacitor 3 beta
- Ensure you have a TypeScript config file, not a JSON one
- Run a live reload command, e.g.
ionic cap run android -l --external
- Notice a new file
capacitor.config.json
is created alongside the existingcapacitor.config.ts
, therefore theserver
parameter never reaches the Android and iOS builds
Output:
n/a
My ionic info
:
Ionic:
Ionic CLI : 6.12.4 (C:\Users\Dennis\AppData\Roaming\nvm\v14.15.5\node_modules\@ionic\cli)
Ionic Framework : @ionic/angular 5.5.5
@angular-devkit/build-angular : 0.1100.7
@angular-devkit/schematics : 11.0.7
@angular/cli : 11.0.7
@ionic/angular-toolkit : 2.3.3
Capacitor:
Capacitor CLI : 3.0.0-beta.6
@capacitor/core : 3.0.0-beta.6
Utility:
cordova-res : not installed
native-run : 1.3.0
System:
NodeJS : v14.15.5 (C:\Program Files\nodejs\node.exe)
npm : 6.14.11
OS : Windows 10
Other Information:
N/A
Issue Analytics
- State:
- Created 3 years ago
- Reactions:9
- Comments:13 (3 by maintainers)
Furthermore, if you update from 2 to 3 today as I did. You will run into the same issue. The .json file keeps getting recreated instead of using the .ts version with base settings.
From this guide: https://capacitorjs.com/docs/updating/3-0
Same problem here (on android, haven’t tried IOS).
Ubuntu 20 Node v16.13.2 NPM 8.1.2 @capacitor/core 3.2.5