Ionic 2 allocation failed when built with --prod

Hey everyone,

I’m currently migrating my IONIC v2Beta11 project (which has always built with no problems) to IONIC v3.0.1.

This is the first time I try to build it with --prod flag and I keep getting “Allocation failed - process out of memory” error.

I’ve tried increasing the maximum memory allocation to 8GB but I still get the same error after a while of constant memory increasement on NodeJs process.

I did it by changing node_modules/.bin/ionic-app-scripts.cmd to:

@IF EXIST “%~dp0\node.exe” (
"%~dp0\node.exe --max_old_space_size=8192 " “%~dp0..@ionic\app-scripts\bin\ionic-app-scripts.js” %*
) ELSE (
@SETLOCAL
@SET PATHEXT=%PATHEXT:;.JS;=;%
node --max_old_space_size=4096 “%~dp0..@ionic\app-scripts\bin\ionic-app-scripts.js” %*
)

Note that ionic build android, ionic run android and ionic serve all works fine.

I’ve read a topic somewhere that says once the projects gets bigger, it stops working.
Is it a known issue?

Could someone help me on this?

package.json

{
  "name": "ionic-hello-world",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": true,
  "scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
  },
  "dependencies": {
    "@angular/common": "4.0.2",
    "@angular/compiler": "4.0.2",
    "@angular/compiler-cli": "4.0.2",
    "@angular/core": "4.0.2",
    "@angular/forms": "4.0.2",
    "@angular/http": "4.0.2",
    "@angular/platform-browser": "4.0.2",
    "@angular/platform-browser-dynamic": "4.0.2",
    "@angular/platform-server": "4.0.2",
    "@ionic-native/app-version": "3.4.2",
    "@ionic-native/camera": "3.4.4",
    "@ionic-native/contacts": "3.4.4",
    "@ionic-native/core": "3.4.4",
    "@ionic-native/keyboard": "3.4.4",
    "@ionic-native/media-capture": "3.4.4",
    "@ionic-native/onesignal": "3.4.4",
    "@ionic-native/photo-viewer": "3.4.4",
    "@ionic-native/social-sharing": "3.4.4",
    "@ionic-native/splash-screen": "3.4.4",
    "@ionic-native/status-bar": "3.4.4",
    "@ionic-native/streaming-media": "3.4.4",
    "@ionic-native/transfer": "3.4.4",
    "@ionic-native/vibration": "3.4.4",
    "@ionic/storage": "2.0.1",
    "@ngx-translate/core": "6.0.1",
    "@ngx-translate/http-loader": "0.0.3",
    "angular2-moment": "1.3.3",
    "font-awesome": "4.7.0",
    "ionic-angular": "3.0.1",
    "ionicons": "3.0.0",
    "moment": "2.17.1",
    "rxjs": "5.1.1",
    "sw-toolbox": "3.4.0",
    "zone.js": "0.8.4"
  },
  "devDependencies": {
    "@ionic/app-scripts": "1.3.3",
    "typescript": "2.2.1"
  },
  "cordovaPlugins": [
    "cordova-plugin-console",
    "cordova-plugin-statusbar",
    "cordova-plugin-whitelist",
    "cordova-plugin-device",
    "cordova-plugin-splashscreen",
    "ionic-plugin-keyboard"
  ],
  "cordovaPlatforms": [],
  "description": "econdos-mobile: An Ionic project",
  "config": {
    "ionic_copy": "./scripts/copy-custom-libs.js"
  }
}

Thank you all in advance!