Giter Club home page Giter Club logo

Comments (10)

apparition47 avatar apparition47 commented on August 17, 2024 1

I'm using cordova-uglify with a webpack Angular2 project and it works fine except when UglifyJS2 mangles the component names in my project.. Using the following in my uglify-config.json allows my uglified code to run:

    "uglifyJsOptions": {
        "mangle" :false,
    },

Just thought I'd put this out there for people having the same issue.

from cordova-uglify.

apparition47 avatar apparition47 commented on August 17, 2024 1

Yes! This setting works with the default Ionic 2 seed.

from cordova-uglify.

rossmartin avatar rossmartin commented on August 17, 2024

Yeah I'm pretty sure I just need to update the default directory that is used to recursively search for .js and .css files. I don't think I'll need to update ng-annotate and UglifyJS.

from cordova-uglify.

MrBokeh avatar MrBokeh commented on August 17, 2024

Actually I should rephrase it, if you use ionic 2 with Angular 2. It will transpire all es6 files to one big es5 .js file regardless you use .js or.ts for your es6 script. And all the .sass files into one big .css file. All the .html files can be remain or in .js depends on if you use that htm like to js minifier or not.

from cordova-uglify.

rossmartin avatar rossmartin commented on August 17, 2024

I'm starting to learn Ionic 2, I plan on supporting it soon.

from cordova-uglify.

rossmartin avatar rossmartin commented on August 17, 2024

@apparition47 Thanks for the info I'll give it a try soon. Is this for an Ionic 2 project?

from cordova-uglify.

rossmartin avatar rossmartin commented on August 17, 2024

Looks like all that is needed to get cordova-uglify working with Ionic 2 is to update the uglify-config.json.

  • Add "build" to the "foldersToProcess" array property in uglify-config.json
...
    "foldersToProcess": [
        "build"
    ],
...
  • Add "mangle": false to the "uglifyJsOptions" in the uglify-config.json -
...
    "uglifyJsOptions": {
        "compress": {
            "drop_console": true
        },
        "fromString": true,
        "mangle" :false
    },
...

I'm going to update the readme and add this info. Thanks @apparition47 @MrBokeh

from cordova-uglify.

apparition47 avatar apparition47 commented on August 17, 2024

@rossmartin I noticed you updated your README, but "mangle": true there, which doesn't work for Angular 2 at the moment. Is that a mistake?

from cordova-uglify.

MrBokeh avatar MrBokeh commented on August 17, 2024

@apparition47 here is my settings which seems works well

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

from cordova-uglify.

rossmartin avatar rossmartin commented on August 17, 2024

@apparition47 Thanks I have a section that describes how to use it with Ionic 2 in the readme. Also in the configuration I note to set mangle to false to work with Ionic 2.

Thanks for the help.

from cordova-uglify.

Related Issues (20)

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.