Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.

3.0.1 Stuck on prod build with ngc #1291

Open
sharonswli opened this issue Oct 24, 2017 · 3 comments
Open

3.0.1 Stuck on prod build with ngc #1291

sharonswli opened this issue Oct 24, 2017 · 3 comments

Comments

@sharonswli
Copy link

sharonswli commented Oct 24, 2017

Note: for support questions, please use one of these channels:

https://forum.ionicframework.com/
http://ionicworldwide.herokuapp.com/

Short description of the problem:

I have recently upgraded my ionic-app-scripts from 1.3.7 to 3.0.1. As per the update instructions, I have also upgraded my webpack to the latest (3.8.1), and added the following to src/index.html
<script src="build/vendor.js"></script>

This works fine on dev builds without the --prod flag and ionic serve
However when I build the app in --prod using ionic cordova build ios --prod, the process seems to stuck at this stage every time (or is painfully slow):
screen shot 2017-10-24 at 3 29 38 pm

The terminal then becomes unresponsive I had to quit the terminal app so the process doesn't go on forever. With 1.3.7 building in AOT takes longer than building in dev, but usually takes no longer than 5 minutes.

Update:

After waiting to build for almost 20 mins, I got a out of memory error:
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

I cannot replicate this issue in a brand new repo. But our app is much larger in size (1GB~ on disk: we have a lot of static assets and 500+ components).

After doing some research on other people's solutions, I finally manage to get a successful build after allocating 8GBs to node (8GBs!!!!)

Solution see here: #1036

in package.json

"ionic:build": "node --max-old-space-size=8192 ./node_modules/@ionic/app-scripts/bin/ionic-app-scripts.js build",

then running npm run ionic:build. Total build time took 24 whole minutes:
screen shot 2017-10-24 at 5 48 29 pm

What behavior are you expecting?

Update app scripts should be able to build with ngc in a reasonable amount of time.

Which @ionic/app-scripts version are you using?
3.0.1

Other information:

Ionic Info

cli packages: (/path/to/project/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 : 3.0.1
    Cordova Platforms  : android 6.2.3 ios 4.4.0
    Ionic Framework    : ionic-angular 3.5.0

System:

    Android SDK Tools : 26.0.2
    ios-deploy        : 1.9.1
    ios-sim           : 6.0.0
    Node              : v6.11.4
    npm               : 3.10.10
    OS                : macOS Sierra
    Xcode             : Xcode 9.0 Build version 9A235
@masimplo
Copy link
Contributor

masimplo commented Nov 3, 2017

@sharonswli what webpack version where you using before? I am assuming you now use 3.8.1. I run into the same situation upgrading to app-stricts 3.0.1 and webpack 3.8.1. Changing webpack to version 3.4.1 remedies the problem, 3.5.0 is the first webpack version introducing the slow build and huge memory usage. There is a related issue open in webpack repo webpack/webpack#5876

@dmastag
Copy link

dmastag commented Nov 9, 2017

Also look at #1280 which is similar

@speedfl
Copy link

speedfl commented Nov 12, 2017

+1

@masimplo how can I force downgrade if webpack?
My build is consuming 8192 to complete (build time is approximatively the same)

I am using app-script: 3.1.0

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants