Giter VIP home page Giter VIP logo

cordova-uglify's People

Contributors

eb1 avatar intuitisoft avatar jimbergman avatar kelvinhokk avatar maftieu avatar matthieucan avatar mrichie avatar rossmartin avatar santino-wu avatar silvioq avatar simonhaenisch avatar stefanomagrassi avatar taivo avatar timothystewart6 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cordova-uglify's Issues

Log/Show the file size.

Hi!

I've used the plugin for a while and I always check the .apk file size to see if it's still "too big" after using the plugin....

So, I've made a little cordova hook that displays the .apk size....
https://gist.github.com/rodrigograca31/49f3cf066b21eb523c0e5085e145cd84

It's not perfect (as outlined in the comments)

It also opens the directory so that the person can drag it to the Play Store faster... (when using cordova build)

I would like to know if you guys could include part of my hook in this plugin to make it show the file size after building/running?

Thanks.

Cannot find module node_modules\cordova-uglify\node_modules\uglify-js

I am having the same issue as this person: #18

However, I've tried following all the steps in #18 but have not been successful in solving the problem.

Upon installation, I receive this response. I'm not sure why, but only imagemin is added to the directory node_modules\cordova-uglify\node_modules

image

My package.json includes the correct dependencies, but they aren't in the directory that this new version cordova-uglify seems to be searching.

Ionic framework error cannot find module uglify-js

I got this since you changed require('uglify-js'); to require(path.join(dependencyPath, 'uglify-js'));

$ cordova platform add android
Adding android project...
Creating Cordova project for the Android platform:
    Path: platforms/android
    Package: com.myproject
    Name: Myproject
    Activity: MainActivity
    Android target: android-23
Android project created with [email protected]
Running command: /myproject/hooks/after_prepare/010_add_platform_class.js /myproject
add to body class: platform-android
Running command: /myproject/hooks/after_prepare/uglify.js /myproject
module.js:341
    throw err;
    ^

Error: Cannot find module '/myproject/node_modules/cordova-uglify/node_modules/uglify-js'
    at Function.Module._resolveFilename (module.js:339:15)
    at Function.Module._load (module.js:290:25)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at Object.<anonymous> (/myproject/hooks/after_prepare/uglify.js:11:16)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Function.Module.runMain (module.js:447:10)
Error: Hook failed with error code 1: /myproject/hooks/after_prepare/uglify.js

Recursively search folder for js files

Why are folders not recursively searched for JS/CSS files? Now we have to identify all subfolders in www/js/ instead of defining www/js in the folders to process.

If another package also depends on uglify-js, the after_prepare hook fails

Not sure this is actually an issue, as this can be easily fixed by running npm install with the --legacy-bundling option (as specified on the README). The problem is that it should be done before running the global npm install to restore packages. It kinds of break the usual workflow of cloning, running npm install, ionic, etc.

The error I'm getting is Error: Cannot find module '/Users/sdurandeu/Documents/projects/vinti/client/node_modules/cordova-uglify/node_modules/uglify-js'.

Is there something I'm missing? What do you think?

Thanks!!

uglify JS files reduced to 'undefined'

I know this there is an open issue on this thread already, however, most of the info on that thread is about deploying from a windows machine.

I am having problems with 'cordova-uglify' on my windows machine deploying my project for Android, but now I am having the same problem on my mac deploying for iOS.

The current version of cordova-uglify is causing 3 files on my windows -> android deploying to be undefined, and 9 files on my mac->iOS to be undefined. Can't use this plugin anywhere.

Solved issue with Cordova 7.0.*

Hi!

I discovered an issue with the uglify process on Cordova Android 7.0.*, because the root folder to assets now is in platforms/android/src/main/assets/www

We must to change the line 46 for this:
wwwPath = path.join(platformPath, platform, 'app', 'src', 'main', 'assets', 'www');

Greetings ;)

Change from hooks to config.xml

Hi there, hooks directory is deprecated in the latest version of Cordova, according to its documentation. Now the hook is defined in config.xml.

You might want to take that into account, that is, add your uglify JS script to config.xml.

processFiles err: Error: ENOENT: no such file or directory

If you are having that error because you are using a newer versions of Ionic/Cordova/Android like me where they moved the folder structure change this line:

wwwPath = path.join(platformPath, platform, 'assets', 'www');

to

wwwPath = path.join(platformPath, platform, 'app', 'src', 'main', 'assets', 'www');

not uglifying

I installed uglify. And i ran cordova build --release android.
And i decompiled release apk using online tool and found all the javascript and css files are as same as my source code. Nothing is minified. And there is not any error on build as well.

files taken by Xcode are not from uglified files from platform/www

When I use the plugin, I have my files under platform/www that are correctly uglified

Then I open Xcode and I see that the www file is the one of the root and not uglified. When I run the code on the emulator, the code I see in the browser is not taken from the platform/www :(

Cannot find module '/usr/src/app/node_modules/uglify-es'

I've been using this plugin for awhile and it has worked great but ever since the latest update I always get the following error when I build my ionic project.

Error: Cannot find module '/usr/src/app/node_modules/uglify-es' at Function.Module._resolveFilename (module.js:536:15) at Function.Module._load (module.js:466:25) at Module.require (module.js:579:17) at require (internal/module.js:11:18) at Object. (/usr/src/app/hooks/after_prepare/uglify.js:10:16) at Module._compile (module.js:635:30) at Object.Module._extensions..js (module.js:646:10) at Module.load (module.js:554:32) at tryModuleLoad (module.js:497:12) at Function.Module._load (module.js:489:3) Error: Hook failed with error code 1: /usr/src/app/hooks/after_prepare/uglify.js

I can fix this by going into the uglify.js file and updating line ten from

var UglifyJS = require(path.join(dependencyPath, 'uglify-es'));

to

var UglifyJS = require(path.join(dependencyPath, 'uglify-js'));

This changed with the latest update and makes so the projects no longer build. Can you push an update with this fixed?

Remove unused files?

Hi!

I just had an idea that could be incorporated into this plugin (or made into a new one)

When installing "libraries" with bower for example, some of them are configured to download only the necessary files/folders (e.g. dist folder). Jquery is one of those.

The problem is that it also downloads AUTHORS.txt, README.md, and other "useless" files/folders

The best way to do this would be to parse the <head> tag and see which files are included via <script> or <link> and remove everything else from www/js, www/css, www/lib .... But I can see this solution causing some problems.... (files that require other files...)

Although it could at least remove some "specific" files like AUTHORS.txt, README.md, and other "useless" files/folders that we know it would not cause problems...

Thoughts?

Thanks!

js files have content undefined

Hi,
when I try uglify, it overwrites all .js files, but they contet is only one single word "undefined".

image

stripped debug log: cordova -d prepare

No scripts found for hook "before_prepare".
Checking config.xml and package.json for saved platforms that haven't been added to the project
Config.xml and package.json platforms are the same. No pkg.json modification.
Package.json and config.xml platforms are different. Updating config.xml with most current list of platforms.
Failed to require PlatformApi instance for platform "browser". Using polyfill instead.
Checking config.xml for saved plugins that haven't been added to the project
Checking for any plugins added to the project that have not been installed in browser platform
No differences found between plugins added to project and installed in browser platform. Continuing...
Generating config.xml from defaults for platform "browser"
Executing script found in hooks directory for hook "after_prepare": hooks\after_prepare\uglify.js
Running command: "C:\Program Files\nodejs\node.exe" D:\NetBeansProjects\ReturnReporting\hooks\after_prepare\uglify.js D:\NetBeansProjects\ReturnReporting
processFiles err: Error: ENOENT: no such file or directory, scandir 'D:\NetBeansProjects\ReturnReporting\platforms\browser\www\module'
uglifying js file D:\NetBeansProjects\ReturnReporting\platforms\browser\www\controller\BaseController.js
uglifying js file D:\NetBeansProjects\ReturnReporting\platforms\browser\www\controller\Home.controller.js
uglifying js file D:\NetBeansProjects\ReturnReporting\platforms\browser\www\controller\Login.controller.js
uglifying js file D:\NetBeansProjects\ReturnReporting\platforms\browser\www\controller\Settings.controller.js
minifying css file D:\NetBeansProjects\ReturnReporting\platforms\browser\www\css\style.css
uglifying js file D:\NetBeansProjects\ReturnReporting\platforms\browser\www\Component.js
encountered a .xml file, not compressing it
uglifying js file D:\NetBeansProjects\ReturnReporting\platforms\browser\www\confighelper.js
uglifying js file D:\NetBeansProjects\ReturnReporting\platforms\browser\www\controller\App.controller.js
uglifying js file D:\NetBeansProjects\ReturnReporting\platforms\browser\www\cordova.js
uglifying js file D:\NetBeansProjects\ReturnReporting\platforms\browser\www\exec.js
encountered a .html file, not compressing it
encountered a .json file, not compressing it

full debug log: uglify_debug.txt

uglify installed from npm

{ name: 'cordova-uglify',
 description: 'Cordova hook that allows you to uglify or minify your apps JavaScript and CSS.',
 'dist-tags': { latest: '0.2.8' },
 versions: 
  [ '0.0.1',
    '0.0.2',
    '0.0.3',
    '0.0.4',
    '0.0.5',
    '0.0.6',
    '0.0.7',
    '0.0.8',
    '0.0.9',
    '0.1.0',
    '0.1.1',
    '0.1.2',
    '0.1.3',
    '0.1.4',
    '0.1.5',
    '0.1.6',
    '0.1.7',
    '0.1.8',
    '0.1.9',
    '0.2.0',
    '0.2.1',
    '0.2.2',
    '0.2.3',
    '0.2.4',
    '0.2.5',
    '0.2.6',
    '0.2.7',
    '0.2.8' ],
 maintainers: [ 'rossmartin <[email protected]>' ],
 time: 
  { modified: '2017-01-19T15:51:35.841Z',
    created: '2014-06-18T03:56:05.284Z',
    '0.0.1': '2014-06-18T03:56:05.284Z',
    '0.0.2': '2014-06-18T05:35:27.107Z',
    '0.0.3': '2014-06-18T05:42:27.368Z',
    '0.0.4': '2014-06-18T05:49:43.994Z',
    '0.0.5': '2014-06-18T05:52:58.761Z',
    '0.0.6': '2014-06-19T05:21:03.197Z',
    '0.0.7': '2014-06-22T22:23:42.514Z',
    '0.0.8': '2014-06-23T00:22:46.231Z',
    '0.0.9': '2014-11-12T05:09:29.435Z',
    '0.1.0': '2014-11-12T05:14:26.594Z',
    '0.1.1': '2014-11-12T05:24:53.626Z',
    '0.1.2': '2014-12-19T15:56:15.972Z',
    '0.1.3': '2014-12-19T16:12:12.345Z',
    '0.1.4': '2015-01-12T22:09:19.752Z',
    '0.1.5': '2015-04-09T20:55:45.840Z',
    '0.1.6': '2015-06-22T14:47:17.993Z',
    '0.1.7': '2015-07-11T02:08:10.764Z',
    '0.1.8': '2015-07-11T02:31:39.325Z',
    '0.1.9': '2015-08-03T21:01:21.157Z',
    '0.2.0': '2015-09-30T13:38:50.084Z',
    '0.2.1': '2015-10-03T16:06:54.283Z',
    '0.2.2': '2015-12-13T22:54:54.170Z',
    '0.2.3': '2015-12-16T01:08:51.901Z',
    '0.2.4': '2016-07-15T15:12:03.110Z',
    '0.2.5': '2016-09-11T17:32:27.083Z',
    '0.2.6': '2016-10-24T14:35:28.131Z',
    '0.2.7': '2016-11-27T04:43:01.635Z',
    '0.2.8': '2017-01-19T15:51:35.841Z' },
 homepage: 'https://github.com/rossmartin/cordova-uglify',
 keywords: [ 'cordova', 'uglify', 'minify', 'hook', 'hooks' ],
 author: 'Ross Martin',
 bugs: { url: 'https://github.com/rossmartin/cordova-uglify/issues' },
 license: 'MIT',
 readmeFilename: 'README.md',
 repository: 
  { type: 'git',
    url: 'git+https://github.com/rossmartin/cordova-uglify.git' },
 users: 
  { okmogwai: true,
    batosai: true,
    cnring18: true,
    gdevise: true,
    ebbm: true },
 version: '0.2.8',
 dependencies: 
  { 'clean-css': '3.4.8',
    'ng-annotate': '0.15.4',
    shelljs: '^0.7.0',
    'uglify-js': '2.4.14' },
 scripts: 
  { postinstall: 'node scripts/install.js',
    postuninstall: 'node scripts/uninstall.js' },
 gitHead: '395775651d1b3a5f3625e4fa3d3ec2ca823664b1',
 dist: 
  { shasum: '5aa9f69797da4c9d51c2f5184f4dcf0510d1b327',
    tarball: 'https://registry.npmjs.org/cordova-uglify/-/cordova-uglify-0.2.8.tgz' },
 directories: {} }

Sourcemap support

Is there a way to create sourcemaps?
I tried a few things from the official uglisfyjs2 documentation but the result.map property is always null. Any idea? Do you have an example that works?

New to uglify, a few questions please.

Hello,

I have never used uglify or minify with any of my programming before, never quite had a business need to do so, but now I do. A few questions if you will. I have created an ionic v1 app (a while ago) for both android and ios - i will be doing a massive overhaul to move from v1 to v4 in the coming months - but just not there yet. I develop for Android on a windows 7 system and iOS on Mac (obviously).

If I install this plugin:

  1. Can I install it in such a way to only uglify/minify my code for when its time to release the app to the stores? I want to be able to still use console and see my html/css when I use chrome/safari inspector tools while developing. I have read about the --release option, but does that mean when using the option it DOES uglify at that moment...or does installing it auto uglify everytime unless you specify --release at which time it won't uglify.

  2. On iOS, I compile everything from command line cordova build myApp and then run it from Xcode to the simulator or to a real device, if uglified (pre-release) will Xcode still be able to see the readable code from the project www root or is it reading code from the platform/www? (for Android I do everything via CLI and only use Studio for SDK Package Manager)

  3. I read the image compression is removed and that HTML is not yet being compressed, is this still the case for both?

  4. I use a few local json files in platform/assets folders, mainly app initialization stuff. Will those files get uglified/minified too?

  5. Are there any additional things I need to be aware of considering my project is on the older ionic v1 platform?

  6. This plugin does everything during the build/prepare process, are there any methods you are aware of that will allow me to ugilify/minify json files that are stored to local assets while the app is running? My app checks for updated json files from central servers for various services and stores them locally for future use, is there anyway I can minify/uglify those json files while the app is running...so it stores them uglified?

HTML

Any chance you will be adding html? Thanks.

Cannot find plugin.xml for plugin "cordova-uglify"

I add to my project config.xml.
Then I run cordova build ios. I receive the following message.

Discovered plugin "cordova-uglify". Adding it to the project
Cannot find plugin.xml for plugin "cordova-uglify". Please try adding it again.

Error installing plugin, can't find plugin.xml

Getting this error when trying to install, this is happening on both my PC (for Android) and my MAC.

C:\myapp>cordova plugin add cordova-uglify --save-dev
(node:16892) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Cannot find plugin.xml for plugin "cordova-uglify". Please try adding it again.

Here is my environment:

Cordova CLI: 8.0.0
Gulp version:  CLI version 3.9.1
Gulp local:   Local version 3.9.1
Ionic Version: 1.3.4
Ionic CLI Version: 1.7.14
Ionic App Lib Version: 0.7.0
OS: Windows 7 SP1
Node Version: v6.10.3

MAC Envi:
Cordova CLI 7.1.1

Question: Is it possible to concatenate JS files using cordova-uglify?

This can save a time spent on multiple requests to file systems to load each JS file. If someone is using AngularJS(Ionic) and is following best practices, then would have separate files for each controller, directive, service or filter. So there can be anywhere between 10-50 JS files.

I'm not sure if we can plug any other tools/hooks to do this.

Latest Ionic 2 installation errors and warnings

Hi Ross,

This plug-in is not longer working with the latest Ionic 2 during installation, here are the errors that I have got:

npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated [email protected]: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0.

[email protected] postinstall /Users/PROJECT_PATH/node_modules/cordova-uglify/node_modules/imagemin/node_modules/imagemin-gifsicle/node_modules/gifsicle
node lib/install.js

✔ gifsicle pre-build test passed successfully

[email protected] postinstall /Users/PROJECT_PATH/node_modules/cordova-uglify/node_modules/imagemin/node_modules/imagemin-jpegtran/node_modules/jpegtran-bin
node lib/install.js

✔ jpegtran pre-build test passed successfully

[email protected] postinstall /Users/PROJECT_PATH/node_modules/cordova-uglify/node_modules/imagemin/node_modules/imagemin-optipng/node_modules/optipng-bin
node lib/install.js

✔ optipng pre-build test passed successfully

[email protected] postinstall /Users/PROJECT_PATH/node_modules/cordova-uglify
node scripts/install.js

fs.js:640
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^

Error: EACCES: permission denied, open '/Users/PROJECT_PATH/hooks/after_prepare/uglify.js'
at Error (native)
at Object.fs.openSync (fs.js:640:18)
at Object.fs.writeFileSync (fs.js:1333:33)
at Object. (/Users/PROJECT_PATH/node_modules/cordova-uglify/scripts/install.js:50:4)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.runMain (module.js:590:10)

Make ugifly.js configurable

Hi,

Wouldn't be useful to be able to use a configuration file for setting the folder to process, specify the cssMinifier, set ngAnnotate (true or false), etc.

I can see that those are hardcoded within the uglify.js file and I think that it will be very usefull to have it over configuration (with default values).

Please let me know what you think and we can have a look to it together if you want (via pull request?) :)

Best,
Yassine

Possible to specify when to run besides --release?

Hi!
Thanks for nice plugin :-)

I wonder if it is possible to specify whether to run cordova-uglify or not, besides the --release option?
E.g. if one wants to use the plugin for certain platforms, and not for others, or for easy testing with or without uglify.

Cheers
-jo

why my asset file not uglify

E:\auth>ionic build android
Running command: "C:\Program Files\nodejs\node.exe" E:\auth\hooks\before_prepare
\02_jshint.js E:\auth
Linting www/js/app.js

File www/js/app.js has no errors.

Linting www/js/constants.js

File www/js/constants.js has no errors.

Linting www/js/controllers.js

File www/js/controllers.js has no errors.

Linting www/js/services.js

File www/js/services.js has no errors.

Running command: "C:\Program Files\nodejs\node.exe" E:\auth\hooks\after_prepare
010_add_platform_class.js E:\auth
add to body class: platform-android
Running command: "C:\Program Files\nodejs\node.exe" E:\auth\hooks\after_prepare
uglify.js E:\auth
ANDROID_HOME=C:\Users\Administrator\AppData\Local\Android\sdk1
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_65
:preBuild UP-TO-DATE
:preDebugBuild UP-TO-DATE

Possible improvements: save-license, do not uglify framework (, images)

I modified the script to KEEP the license at the beginning of my code and exclude frameworks like jquery as they might have issues.

In declarations:

var saveLicense = require('uglify-save-license');

then in "compress" function

switch (ext) {
case '.js':
  
console.log('?? js file ' + file);
 if (file.indexOf("jquery")<=-1) {
   console.log('--------------------uglifying js file ' + file);
    res = ngAnnotate(String(fs.readFileSync(file)), {
        add: true
    });
    
    result = UglifyJS.minify(res.src, {
            compress: {
                "drop_console": true
            }, 
            output: {
                comments: saveLicense
            },
            //fromString: true //removed because incompatible with uglify-js3
        });
    fs.writeFileSync(file, result.code, 'utf8'); // overwrite the original unminified file
}
  break;

I think those two things are quite useful.
I did not issue a pull request as the code (especially for skipping jquery) is quite poor...

Would be great if those two things could be implemented.

I found also code about image but I think those were yours original and for some reason got deleted?

Thanks

recursiveFolderSearch:true require foldersToProcess

Hi,
When I set "recursiveFolderSearch": true, it always ask for "foldersToProcess" , but in docs. is written opposite:

"foldersToProcess": [ // when recursiveFolderSearch is set to false only files in these directories will be processed

my uglify-config.json

{
    "alwaysRun": true,
    "recursiveFolderSearch": true,
    "foldersToProcess": [
        "js",
        "css",
        "img",
        "build"
    ],
    "uglifyJsOptions": {
        "compress": {
            "drop_console": true
        },
        "fromString": true,
        "mangle": false
    },
    "cleanCssOptions": {
        "noAdvanced": true,
        "keepSpecialComments": 0
    }
} 

debug log: cordova -d prepare

No scripts found for hook "before_prepare".
Checking config.xml and package.json for saved platforms that haven't been added to the project
Config.xml and package.json platforms are the same. No pkg.json modification.
Package.json and config.xml platforms are different. Updating config.xml with most current list of platforms.
Failed to require PlatformApi instance for platform "browser". Using polyfill instead.
Checking config.xml for saved plugins that haven't been added to the project
Checking for any plugins added to the project that have not been installed in browser platform
No differences found between plugins added to project and installed in browser platform. Continuing...
Generating config.xml from defaults for platform "browser"
rm: could not remove directory (code EBUSY): D:\NetBeansProjects\ReturnReporting\platforms\browser\www

mkdir: path already exists: D:\NetBeansProjects\ReturnReporting\platforms\browser\www

Executing script found in hooks directory for hook "after_prepare": hooks\after_prepare\uglify.js
Running command: "C:\Program Files\nodejs\node.exe" D:\NetBeansProjects\ReturnReporting\hooks\after_prepare\uglify.js D:\NetBeansProjects\ReturnReporting
processFiles err: Error: ENOENT: no such file or directory, scandir 'D:\NetBeansProjects\ReturnReporting\platforms\browser\www\js'
processFiles err: Error: ENOENT: no such file or directory, scandir 'D:\NetBeansProjects\ReturnReporting\platforms\browser\www\img'
processFiles err: Error: ENOENT: no such file or directory, scandir 'D:\NetBeansProjects\ReturnReporting\platforms\browser\www\build'
minifying css file D:\NetBeansProjects\ReturnReporting\platforms\browser\www\css\style.css
Command finished with error code 0: C:\Program Files\nodejs\node.exe D:\NetBeansProjects\ReturnReporting\hooks\after_prepare\uglify.js,D:\NetBeansProjects\ReturnReporting

CSS: minified files with content 'undefined'

I was trying to use cordova-uglify, but my CSS files were receiving the string 'undefined' instead of the css code minified.

I saw your last modification 03e59f8 and you have changed var CleanCSS = require('clean-css'); for var CleanCSS = require(path.join(dependencyPath, 'clean-css'));

https://github.com/rossmartin/cordova-uglify/blob/master/after_prepare/uglify.js#L12

I don't know why, but replacing clean-css inside node_modules folder for clean-css that I've just installed by npm solved my problem. It seems that there is some error with clean-css distributed together with cordova-uglify.

Ionic 4?

Hello,
it doesnt work for ionic 4?

Support ES6

This package could also support ES6, for that you just need to change from uglify-js to uglify-es
They have the same syntax, so, you just need to change your package.json

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.