Ionic cordova build Get Stuck at "Generating ES5 bundles for differential loading..."

When I was building my ionic app via “ionic cordova run android --device --verbose”, it got stuck at …


> ng.cmd run app:ionic-cordova-build --platform=android
  ng:analytics getGlobalAnalytics +0ms
  ng:analytics Client Analytics config found: false +38ms
  ng:analytics Analytics disabled. Ignoring all analytics. +0ms
  ng:analytics getSharedAnalytics +1ms
Generating ES5 bundles for differential loading...

I had been loading for over 10 minutes. I don’t know how to handle!

Here is the information of the modules:

npm: 6.9.0
ionic: 5.4.13
cordova: 9.0.0 (cordova-lib@9.0.1)

Thank you.

2 Likes

One thing you can try is to make it not do that.

Change your browserslist to read:

last 2 Chrome versions
last 2 Safari versions

(for example), and it won’t bother building ES5 bundles.

3 Likes

My existing browserlist:

# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries

# You can see what browsers were selected by your queries by running:
#   npx browserslist

> 0.5%
last 2 versions
Firefox ESR
not dead
not IE 9-11 # For IE 9-11 support, remove 'not'.

How should I place your things? Thanks.

Same issue here. Running the cordova build command with --verbose, I get this error message:

[error] Error: Call retries were exceeded
    at ChildProcessWorker.initialize (/Users/me/Documents/apps/myapp/node_modules/jest-worker/build/workers/ChildProcessWorker.js:193:21)
    at ChildProcessWorker.onExit (/Users/me/Documents/apps/myapp/node_modules/jest-worker/build/workers/ChildProcessWorker.js:263:12)
    at ChildProcess.emit (events.js:198:13)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)

It seems to be connected with this issue:

But I still can’t manage to get it solved.

Edit: Error occurs on one of my projects only. For all others I can build without any problems. Could there be a performance issue with cordova/Ionic? My machine (MBP, 2,7 GHz i7, 16 GB RAM) should be able to build my projects I guess…

EDIT2 / Temporary solution:
There was a change in @angular-devkit/build-angular which updated the differential loading. To fix this in your Ionic project, change the target value from “es2015” to “es5” in your tsconfig.json:

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "module": "esnext",
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "importHelpers": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2018",
      "dom"
    ]
  },
  "angularCompilerOptions": {
    "fullTemplateTypeCheck": true,
    "strictInjectionParameters": true
  }
}

Let’s hope there’s a real fix for that soon but in the meantime we at least can build our projects.

25 Likes

This actually assisted me very much. I was able to build my project and run it on a real device. Thank you!

Replace all lines that don’t start with a # with them.

1 Like

Bingo result, thanks

really thank you
it is useful for me

1 Like

Thanks a lot, this help me

1 Like

Thank you! It works for me

Worked for me. Thank you!

Worked for me too :+1:

1 Like

thanks that sorted the issue for me to!

nice, helped me, now lets see if my google maps work haha thanks!

For anyone else experiencing this problem, I’ve realized that I had some circular references in modules configuration(imports/exports) fixing that circular references make the problem go away.

I ran into more issues after changing to ‘es5’. But a solution that always work without needed to change anything, Is to build for angular first. Run:

ng build

Then

Ionic cordova build android

no use after changing es2015 to es5