--prod builds suddenly failing

I suddenly have an issue creating production builds

ionic cordova run android

works fine and generates a debug build on the device.

But all of a sudden if I try

ionic cordova run android --prod

I get this in the console:

[15:36:37]  build prod started ...
[15:36:37]  clean started ...
[15:36:37]  clean finished in 3 ms
[15:36:37]  copy started ...
[15:36:37]  ngc started ...
[15:36:56]  ngc finished in 18.50 s
[15:36:56]  preprocess started ...
[15:36:56]  deeplinks started ...
[15:36:57]  deeplinks finished in 1.61 s
[15:36:57]  optimization started ...
[15:36:57]  copy finished in 20.34 s
[15:37:15]  optimization finished in 17.85 s
[15:37:15]  preprocess finished in 19.46 s
[15:37:15]  webpack started ...
[15:38:24]  webpack finished in 68.85 s
[15:38:24]  sass started ...
[15:38:24]  uglifyjs started ...
[15:38:26]  sass finished in 2.06 s
[15:38:26]  cleancss started ...
[15:38:28]  cleancss finished in 1.85 s
[15:38:54]  uglifyjs finished in 30.10 s
[15:38:54]  postprocess started ...

I’ve uninstalled Node and re-installed it and uninstalled and re-installed ionic and cordova. But the same thing happens.

Here’s my Ionic Info output

cli packages: (/Users/richardshergold/IonicProjects/myproject/node_modules)

    @ionic/cli-utils  : 1.10.2
    ionic (Ionic CLI) : 3.10.3

global packages:

    Cordova CLI : 7.0.1

local packages:

    @ionic/app-scripts : 2.1.4
    Cordova Platforms  : android 6.2.3
    Ionic Framework    : ionic-angular 3.4.0

System:

    ios-deploy : 1.9.0
    Node       : v7.10.1
    npm        : 4.2.0
    OS         : macOS Sierra
    Xcode      : Xcode 8.3.3 Build version 8E3004b

I chose to install Node 7.10.1 because the first time I tried 6.11.3 and that didn’t solve the problem (can I use the very latest - 8.5?)

Ionic serve works fine. Any ideas?

I don’t see any errors in your console output for the build --prod.

Did you copy and paste everything or does it just stop at postprocess started?

It might be helpful if you add a --verbose flag to the build command to get more details on where it might be hanging up.

Try creating a blank and and see if you can build that.

This turned out to be a problem with the latest App Scripts (2.1.4) which failed to build for Production due to a Source Maps issue (I had generated source maps for Ionic Pro Monitoring earlier in the day). Stepping down to 2.0.1 fixed the issue.

2 Likes

BTW Dan Bucholtz (Ionic) helped me out with this last night so they are aware of the issue and he says it will be fixed in the next release.

hi richardshergold, I have same problem but when i run usin “ionic cordova run android --prod” it work up to
[16:18:47] build prod started …
[16:18:47] clean started …
[16:18:47] clean finished in less than 1 ms
[16:18:47] copy started …
[16:18:47] deeplinks started …
[16:18:47] deeplinks finished in 100 ms
[16:18:47] ngc started …
[16:19:04] ngc finished in 16.55 s
[16:19:04] preprocess started …
[16:19:04] preprocess finished in 2 ms
[16:19:04] webpack started …
[16:19:05] copy finished in 17.34 s
[16:19:45] webpack finished in 40.74 s
[16:19:45] uglify started …
[16:19:45] sass started …
[16:19:47] sass finished in 1.91 s
[16:19:47] cleancss started …
[16:19:50] cleancss finished in 3.13 s

then it stop how can i solve this issue.
please help me…!