Ionic build issues?

Hello everyone,

I’m facing a really hard to understand issue with the ionic-app-scripts and the build for platform browser. Builds made on my machine and on Jenkins are highly different and doesn’t seem like the builds on Jenkins are producing the correct output.

Let’s start with the basic info of Ionic versions.
Jenkins:

[jenkins@bb-jenkins root]$ ionic info
******************************************************
 Dependency warning - for the CLI to run correctly,      
 it is highly recommended to install/upgrade the following:     
 Please install your Cordova CLI to version  >=4.2.0 `npm install -g cordova`
******************************************************
Your system information:
Cordova CLI:  You have been opted out of telemetry. To change this, run: cordova telemetry on.
6.5.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 3.10
Node Version: v6.6.0
Xcode version: Not installed
******************************************************
 Dependency warning - for the CLI to run correctly,      
 it is highly recommended to install/upgrade the following:     
 Please install your Cordova CLI to version  >=4.2.0 `npm install -g cordova`
******************************************************

Development machine:

 ~ ionic info
Your system information:

Cordova CLI: 6.3.1
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
ios-deploy version: 1.9.0
ios-sim version: 5.0.8
OS: macOS Sierra
Node Version: v6.7.0
Xcode version: Xcode 8.2 Build version 8C38

Now, I’ve created an NPM script called build:browser with the following command:
ionic-app-scripts build browser --prod --release

Running this on my development machine everything seems to be going according to what is expected. However, jenkins won’t produce the same output.

Here’s an output of the generated files in the platforms/browser/www directory on my dev machine:

 ~ ll platforms/browser/www
total 232
drwxr-xr-x  16 dev  staff    544 Feb 14 11:11 .
drwxr-xr-x  13 dev  staff    442 Feb 14 11:11 ..
-rw-r--r--   1 dev  staff   1386 Feb 14 11:11 ServiceWorker.js
drwxr-xr-x   7 dev  staff    238 Feb 14 11:11 assets
drwxr-xr-x   7 dev  staff    238 Feb 14 11:11 build
-rw-rw-rw-   1 dev  staff   3557 Feb 14 11:11 config.xml
-rw-rw-rw-   1 dev  staff   3049 Feb 14 11:11 confighelper.js
drwxr-xr-x   5 dev  staff    170 Feb 14 11:11 cordova-js-src
-rw-rw-rw-   1 dev  staff  59083 Feb 14 11:11 cordova.js
-rw-r--r--   1 dev  staff  18171 Feb 14 11:11 cordova_plugins.js
-rw-rw-rw-   1 dev  staff   4789 Feb 14 11:11 exec.js
-rw-r--r--   1 dev  staff   1279 Feb 14 11:11 index.html
-rw-r--r--   1 dev  staff     60 Feb 14 11:11 manifest.json
-rw-rw-rw-   1 dev  staff   1602 Feb 14 11:11 platform.js
drwxr-xr-x  27 dev  staff    918 Feb 14 11:11 plugins
-rw-r--r--   1 dev  staff    736 Feb 14 11:11 service-worker.js

Here is the same folder after running the build on Jenkins:

[celso_santos@bb-jenkins DEV-IonicApp]$ ll platforms/browser/www/
total 120
drwxr-xr-x.  6 jenkins jenkins    53 Feb 14 11:00 assets
-rw-rw-rw-.  1 jenkins jenkins  3049 Feb 14 11:00 confighelper.js
-rw-rw-rw-.  1 jenkins jenkins  3444 Feb 14 11:00 config.xml
-rw-rw-rw-.  1 jenkins jenkins 59083 Feb 14 11:00 cordova.js
drwxr-xr-x.  2 jenkins jenkins    60 Feb 14 11:00 cordova-js-src
-rw-r--r--.  1 jenkins jenkins 17646 Feb 14 11:00 cordova_plugins.js
-rw-rw-rw-.  1 jenkins jenkins  4789 Feb 14 11:00 exec.js
-rw-r--r--.  1 jenkins jenkins  1279 Feb 14 11:00 index.html
-rw-r--r--.  1 jenkins jenkins    60 Feb 14 11:00 manifest.json
-rw-rw-rw-.  1 jenkins jenkins  1602 Feb 14 11:00 platform.js
drwxr-xr-x. 26 jenkins jenkins  4096 Feb 14 11:00 plugins
-rw-r--r--.  1 jenkins jenkins   736 Feb 14 11:00 service-worker.js
-rw-r--r--.  1 jenkins jenkins  1386 Feb 14 11:00 ServiceWorker.js

Why does this happen? I made sure, on Jenkins, to delete the workspace before and after the build (and even both at the same time) always with the same result.

Interestingly enough, on Jenkins, running ionic build browser --prod --release seems to behave a bit better.

Can anyone help understand what’s the issue here? Is ionic-app-scripts not ready to deal with desktop? And if so, why does it work correctly on my machine but not on the build machine?

Best Regards,
Celso Santos