ionic-cli icon indicating copy to clipboard operation
ionic-cli copied to clipboard

"ionic package build" doesn't run "npm run build" so doesn't care about --prod flag

Open rory-austin opened this issue 9 years ago • 1 comments

What version of the CLI are you using? Output of ionic --version

2.2.3

Short description of the problem:

Adding --prod to ionic package build doesn't result in a minified build (if your previous build was not minified) like it does when using ionic build

What behavior are you expecting?

It seems that ionic package build simply uses whatever happens to be in /www without running a npm run build. The --prod is ignored with ionic package which means that if I previously ran a --prod build and then run ionic package I get a minified build. If I previously ran a non --prod build for example with ionic serve and then run ionic package --prod it will not be minified.

Steps to reproduce:

  1. Run npm run build
  2. Run ionic package build android --profile <profile> --release --prod
  3. Run npm run build --prod
  4. Run ionic package build android --profile <profile> --release --prod

Compare the two APK's produced. Second one should be smaller, start up faster, etc. Step 1 can be swapped out with ionic serve Step 3 could be swapped out with ionic build android --prod or ionic build browser --prod etc. The --prod in step 2 and 4 is essentially meaningless at this point.

Post the output of ionic info below please

Your system information:

ordova CLI: 6.5.0 Ionic Framework Version: 3.1.1 Ionic CLI Version: 2.2.3 Ionic App Lib Version: 2.2.1 Ionic App Scripts Version: 1.3.6 ios-deploy version: Not installed ios-sim version: Not installed OS: Windows 10 Node Version: v6.10.1 Xcode version: Not installed

rory-austin avatar May 04 '17 12:05 rory-austin

Thanks for the detailed report. We'll be adding this feature to the new v3 CLI. We'll be tracking this through this issue: https://github.com/driftyco/ionic-cli/issues/2210

imhoffd avatar May 04 '17 18:05 imhoffd