ionic-team / ionic-app-scripts

App Build Scripts for Ionic Projects
http://ionicframework.com/
MIT License
608 stars 305 forks source link

Error occurred during command execution from a CLI plugin #1020

Open osamasoliman opened 7 years ago

osamasoliman commented 7 years ago

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

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

Short description of the problem:

I got this error when using --prod flag while building ionic cordova build android --prod I have the latest versions of everything in my package.json anyone faced this problem before?

$ ionic cordova build android --prod
Running app-scripts build: --prod --iscordovaserve --externalIpRequired --nobrowser

[15:51:12]  build prod started ...
[15:51:12]  clean started ...
[15:51:12]  clean finished in 9 ms
[15:51:12]  copy started ...
[15:51:12]  ngc started ...
[15:51:38]  ngc finished in 26.14 s
[15:51:38]  preprocess started ...
[15:51:38]  deeplinks started ...
[15:51:40]  deeplinks finished in 1.80 s
[15:51:40]  optimization started ...
[15:51:41]  copy finished in 28.58 s
[15:52:16]  optimization finished in 36.17 s
[15:52:16]  preprocess finished in 37.98 s
[15:52:16]  webpack started ...
[15:54:36]  webpack finished in 140.11 s
[15:54:36]  sass started ...
[15:54:36]  uglifyjs started ...
[WARN] Error occurred during command execution from a CLI plugin (@ionic/cli-plugin-cordova). Your plugins may be out of date.
Error: Unexpected token operator «=», expected punc «,» in C:\Users\Osama\ParentApp\www\build\main.js at line 109481, col 38, pos 4249270

What behaviour are you expecting?

Normal production building

Steps to reproduce: I think it's because of uglifying using uglify-js where there's es2015 code it can't deal with specifically Default Parameters Why wasn't this code compiled to es5 with typescript? should you be using uglify-es instead?

line 109481, col 38, pos 4249270:

function debounce(fn, wait, immediate = false) {

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

Other information: (e.g. stacktraces, related issues, suggestions how to fix, stackoverflow links, forum links, etc) https://forum.ionicframework.com/t/error-occurred-during-command-execution-from-a-cli-plugin/92686 https://github.com/mishoo/UglifyJS2/tree/harmony

mbdwey commented 7 years ago

Hello Osama, I face similar case and the reason was we try to declare entryComponents dynamically EX: entryComponents: entryComponents(), after changing it to just use the list it works

arnoldparge commented 7 years ago

Hi, I am facing the same problem. ionic start up time is around 20 seconds. Hence, I thought of building a prod build but I get that same error. all my plugins are updated. ionic info below:

global packages:

@ionic/cli-utils : 1.4.0
Cordova CLI      : 7.0.0
Ionic CLI        : 3.4.0

local packages:

@ionic/app-scripts              : 2.0.0
@ionic/cli-plugin-cordova       : 1.4.0
@ionic/cli-plugin-ionic-angular : 1.3.1
Cordova Platforms               : android 6.2.3
Ionic Framework                 : ionic-angular 3.5.0

System:

Node       : v8.1.2
OS         : Windows 10
Xcode      : not installed
ios-deploy : not installed
ios-sim    : not installed
npm        : 5.0.3

@mbdwey May be that could be of help but I didn't understand. Could you please explain with example.

I AM NEW