Search code examples
cordovabuildundefinedminifyuglifyjs

Cordova - cordova-uglify plugin changes content to 'undefined' when uglified


After installing,

npm install cordova-uglify --save-dev

and when running,

cordova build android --release

all the css are minified correctly.

But, JS files contents are replaced with 'undefined'.

What might be the issue?

What kind of information should I give you to solve it?

Please help guys?

SOLUTION:

Reinstall cordova-uglify with the version 0.2.9 (or) follow the accepted answer.


Solution

  • Turns out we had an old uglify-config.json. Specifically this property was causing the output to be undefined:

    "uglifyJsOptions": { "fromString": true }
    

    More info on GitHub: https://github.com/rossmartin/cordova-uglify/issues/35#issuecomment-344738718