Hey guys, noob here. I have watch tutorials on ionic and angular, and I just can’t differentiate all these 3 as saw different developers used 3 different kinds of command.
npm run build
ng build
ionic build
Can anyone tell me what’s the difference and which one should I actually run for my ionic project?
If you run ng build directly, Ionic hooks won’t be triggered as it is bypassed.
npm run build picks the "build" from package.json which is the same as ng build. It is helpful for CI where you do not have ionic or ng commands available. There you can simply run npm run build -- --prod.
To build on @sagrawal’s answer, you can change what npm build does by editing package.json, so while it may be true that by default it’s "the same as ng build", it certainly doesn’t have to be. I’m also not clear on why one can’t have ionic or ng CLI tools in a CI build - I have done this before.