ionic-cli
ionic-cli copied to clipboard
Unable to serve to disk while using ionic build --engine=cordova
Description:
Ionic 4 Angular project supports serving to disk with on-the-fly compiling of sources for browser engine by calling ionic build --engine=browser -- --watch. In that case if any change to assets is made than www directory is updated.
But there are no such option for cordova engine, i.e. if I call ionic build --engine=cordova --platform=android -- --watch then Unknown option: '--watch' appears.
AFAIK previous Angular project template has this feature (you could use just ionic serve --no-open to get the same behavior as for Ionic 4 browser engine).
In other words, Angular 4 project doesn't provide an ability to watching over sources and compile cordova-compatible assets on the fly. Eventually, it breaks cordova-simulate livereload scenarios and, consequently, Cordova Extension for VS Code simulate scenarios with livereload enabled https://github.com/microsoft/vscode-cordova/issues/532#issuecomment-496563067.
In general, if there are any other ways of how to achieve compiling of Ionic 4 angular project with cordova integrated and livereload then it would be enough.
Steps to Reproduce:
- Create Ionic 4 angular project:
ionic start ionic4app tabs --cordova --type=angular --no-link
cd ionic4app
ionic cordova platform add android
- Run
ionic build --engine=browser -- --watch, then change e.g.src/app/tab1/tab1.page.htmland see thatwwwdirectory is updated - Run
ionic build --engine=cordova --platform=android -- --watchand seeUnknown option: '--watch'error is appeared.
My ionic info:
Ionic:
ionic (Ionic CLI) : 4.12.0 (/home/akvelon/.nvm/versions/node/v12.0.0/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.4.2
@angular-devkit/build-angular : 0.13.9
@angular-devkit/schematics : 7.3.9
@angular/cli : 7.3.9
@ionic/angular-toolkit : 1.5.1
Cordova:
cordova (Cordova CLI) : 8.1.2 ([email protected])
Cordova Platforms : android 7.1.4, ios 4.5.5
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.0.1, (and 4 other plugins)
System:
Android SDK Tools : 26.1.1 (/work/sdk)
NodeJS : v12.0.0 (/home/akvelon/.nvm/versions/node/v12.0.0/bin/node)
npm : 6.9.0
OS : Linux 4.15
Thanks @ruslan-bikkinin! We use custom Angular builders for the Cordova build/serve. That means we need to implement flags such as --watch. I created an issue for this in our Angular Toolkit: https://github.com/ionic-team/angular-toolkit/issues/138
Thanks for letting me know, looking forward for this.
Hi @dwieeb . Is there any progress on this?
@dwieeb Could you please take a look on this?
Hi @dwieeb. Could you please take a look at this?