error : ionc build ios or android, uglifyjs failed: SyntaxError: Unexpected token: operator (>) #239
Comments
Hello, thanks for opening an issue with us! uglifyJS does support arrow functions. Are you using the correct syntax for arrow functions? |
From @haxpor on October 20, 2016 17:56 @jgw96 it happens the same for me with It seems uglifyJS has es6 support but in another branch Is it the case? If not, how to make this works with ionic 2. Updated: I solved the problem now. As @jgw96 said that uglifyJS already supports es6, I just changed |
From @tianleios on October 21, 2016 8:32 @haxpor can you display you resolve function detail |
From @tianleios on October 21, 2016 8:32 @jgw96 i confirm i use correct arrow function |
From @haxpor on October 22, 2016 1:22 @tianleios On your root project directory, edit Then after that execute |
Our solution will be to provide a hook so users that need to can transpile/modify the code down to es5. We won't be supporting this directly in I'll implement the hook and documentation. Thanks, |
I am getting a similar error:
I tried changing the "uglify-js" to "git+https://github.com/mishoo/UglifyJS2.git#harmony" in the node_modules/@ionic/app-scripts/package.json as recommended above, but it does not solve the error. |
I'm not sure. I think a base case would be trying to minify that library on it's own independent from app-scripts or ionic. It may just be a bug in the library itself. Thanks, |
Thanks a lot @jgw96 ..... as per you suggestion I did the changes & my application successfully deployed on device without showing any uglifyjs error. Also my async method working as I expected..... |
We have added some alternative options to uglify. Unfortunately, uglify does not work well with ES2015 code. Feel free to use Thanks, |
I'm getting error on production build with webpack uglifyjs failed: SyntaxError: Invalid syntax: 0a. Tried the harmony solution given by @jgw96 but didn't solve the bug. After installing ionic-app-scripts from master how do I use closure or babili ? |
@danbucholtz Awesome, thanks Dan! I'm super excited for this... I've been having to just disable uglify when this happens.. |
Hey @BradyLiles how did you manage to disable uglifyjs? I can't seem to find a way to do it without resorting to hacky solutions (or, is that what you did?). |
Definitely just did a awesome hacky fix... However, I do know (Well at least think) that you can do it without a hack by passing the correct flags whenever you build.. |
You might also be able just to override the uglifyjs.config.js file and make it work for you over there... Seems like they have some options you might be able just set to false/null and get away with not doing a hacky approach. |
@callodacity, You can disable minification by running Thanks, |
@danbucholtz @BradyLiles Thanks guys - appreciate that 👍 Previously I was just editing the build file inside |
@danbucholtz is there a way to minify with something else, what about the UglifyJS harmony solution? |
The harmony fix never works with app-scripts v1.3.7, it used to work with older versions of app-scripts though.
|
@KarimMesallam, You could try Thanks, |
From @tianleios on October 20, 2016 12:2
when i run ionic build ios. will display fllow errror,uglifyjs cannot support es6 feature arrow function
] ngc finished in 32.81 s
[19:52:49] bundle started ...
[19:53:01] bundle finished in 12.33 s
[19:53:01] uglifyjs started ...
[19:53:01] sass started ...
[19:53:02] uglifyjs failed: SyntaxError: Unexpected token: operator (>)
[19:53:02] ionic-app-script task: "build"
[19:53:02] Error: SyntaxError: Unexpected token: operator (>)
Copied from original issue: ionic-team/ionic-framework#8817
The text was updated successfully, but these errors were encountered: