New diifferences between 'ionic build' and 'ionic cordova build'

Hi

Can someone explains me ‘for dummies’ what are the differences between this commands?

This is the info in the ionic changelog but I not understand completely:

Added ionic build (finally). Now you can invoke a build for web assets and prepare them for platform targets. For Ionic/Cordova apps, this means running cordova prepare after the build, allowing you to use Android Studio or Xcode for native build/test/deploy. It is different from ionic cordova build in that it does not run cordova build. The native build must happen separately, if at all.

Thanks

1 Like
  • ionic build only does a build from src to www.
  • ionic cordova build does the same, but also cordova prepare (which copies from www to the /platforms directory into ios and android) and then runs the cordova build via cordova build to create an app out of the native stuff and the copied www.
2 Likes

Thanks sujan,

And then, on wich cases are appropiate to use only ionic build?

It is suposed that an ionic project is always to mobile devices(cordova)

No?

No, Ionic can also be used to build websites and PWAs.
You can also wrap it into Electron or a UI-less browser to distribute as a native desktop app.
As this is being done more and more, specifically PWAs, this command was added.

3 Likes

Thanks, now it’s clear

1 Like

your reply needs to be mentioned in the official doc.