Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to Debug/verbose uglify task while build:release

User_LXGWISep 25 2017 — edited Feb 7 2018

He have been using Oracle JET for a while.... During our release builds sometimes there are failures reported by Uglify JS, for instance  :

grunt  build:release

copy files to staging directory.....

copy finished...

copy library files to staging directory.....

copy finished...

compiling sass....

sass compile

from /Users/DARANGEL/Documents/src/uno-ui/src/themes/blue/web/blue.scss

to    /Users/DARANGEL/Documents/src/uno-ui/themes/blue/web/blue.min.css finished..

sass compile finished...

running theme injection task.....

indexHtml theme path injection finished..

running theme copy task.....

theme copy finished...

running injection task.....

mainJs paths injection finished..

running uglify tasks.....

>> SyntaxError: Unexpected token: name (stack)

As we couldn't find any documentation on how to actually display which file is causing the above failure... we had to make a change in the uglify code with a really ugly workaround, We found the related code that was throwing the error and then we added a trace command :

/node-modules/uglify-js/lib/parse.js

function unexpected(token) {

  console.trace()  //  HERE THE DIAGNOSTIC CHANGE TO DETERMINE THE FAILURE

   if (token == null)

  token = S.token;

  token_error(token, "Unexpected token: " + token.type + " (" + token.value + ")");

};

Which eventually printed the stack and we were able to track the specific file that was causing the error.

As you can see this is not a reliable/scalable way to find uglify violations... Is there a way to pass a VERBOSE or DEBUG parameter to the mentioned command to simplify the recognition of errors during the build ?

Thanks

Daniel

Comments
Post Details
Added on Sep 25 2017
2 comments
604 views