ionic buildPS C:\Projects\Ionic Demo Projects\pwaTest> ionic build --prod
Running app-scripts build: --prod
[18:59:57] build prod started ...
[18:59:58] clean started ...
[18:59:58] clean finished in 8 ms
[18:59:58] copy started ...
[18:59:58] deeplinks started ...
[18:59:58] deeplinks finished in 71 ms
[18:59:58] ngc started ...
[19:00:19] ngc finished in 21.62 s
[19:00:19] preprocess started ...
[19:00:19] preprocess finished in 4 ms
[19:00:19] webpack started ...
[19:00:21] copy finished in 23.21 s
[19:01:24] webpack finished in 64.11 s
[19:01:24] uglify started ...
[19:01:24] sass started ...
[19:01:26] sass finished in 2.61 s
[19:01:26] cleancss started ...
[19:01:30] cleancss finished in 4.11 s
[19:01:57] uglify finished in 33.02 s
[19:01:57] postprocess started ...
[19:01:57] postprocess finished in 18 ms
[19:01:57] lint started ...
[19:01:57] build prod finished in 119.28 s
> ionic cordova prepare --no-build
> cordova prepare
Error: No platforms added to this project. Please use `cordova platform add <platform>`.
[ERROR] An error occurred while running cordova prepare (exit code 1).
[19:02:04] lint finished in 7.53 s
PS C:\Projects\Ionic Demo Projects\pwaTest>
Maybe it should check before running ionic cordova prepare --no-build if a platform actually is added?
I have a distinct issue but will post here because I think they are closely related and could be addressed at the same time.
There doesn't seem to be a way to simply run a non-cordova build of an ionic app. By this I mean run the exact same build as ionic serve without running any cordova commands at all. The current implementation of ionic build always executes cordova prepare, but sometimes that may not be desired (even if platforms have been added) and there doesn't seem to be a switch to turn that off.
For example, If I want to write an npm script to deploy a non-cordova build of the web app to a web server. I would like to just build to the /www folder without starting the dev server or running any cordova commands, and then deploy the build output. This should be simple but I can't find a way to do it.
In my mind, ionic build should behave this way by default. There is no need to run cordova prepare. ionic cordova build and other ionic cordova * commands should run cordova prepare if necessary.
I thought the whole point of putting all the cordova commands under ionic cordova * was to clearly separate out all of the cordova commands, but the current behaviour of ionic build muddies up that clarification.
Anyhow, I recognize that removing cordova prepare from ionic build would change existing behaviour and might not be desirable, but if not, at least if a command line switch could be added to skip the cordova prepare step, that would be helpful.
@jaufgang Agreed, the ionic cordova prepare should be enough. ionic build should not run Cordova. This is fixed with the CLI RC. (Please test: npm i -g ionic@rc).
@janpio Original issue is fixed in https://github.com/ionic-team/ionic-cli/commit/9607de9728efd825a63af03cfa0df6a93127d68b -- forgot to add this issue into the commit.
Wow, that was a fast response! Thanks!
@jaufgang Yes, we are working fast to get CLI 4 out and Ionic Angular 4 out. 馃槃
Please continue to report bugs and/or things you find strange. I greatly appreciate it!
Most helpful comment
@jaufgang Agreed, the
ionic cordova prepareshould be enough.ionic buildshould not run Cordova. This is fixed with the CLI RC. (Please test:npm i -g ionic@rc).@janpio Original issue is fixed in https://github.com/ionic-team/ionic-cli/commit/9607de9728efd825a63af03cfa0df6a93127d68b -- forgot to add this issue into the commit.