es-uglify-loader

1.0.1 • Public • Published

es-uglify-loader

Uglify es loader for webpack(fork from uglify-loader) Use Uglify-es insteadof Uglify-js

To install

npm install uglify-loader --save-dev

Use Case

Webpack has UglifyJSPlugin that uglifies the output after bundling. In the applications that depend on thirdparty libraries you may want to uglify with mangling only your application code but not the code that you don't control.

Example

Webpack 1

module: {
    loaders: [
        {
            // I want to uglify with mangling only app files, not thirdparty libs
            test: /.*\/app\/.*\.js$/,
            exclude: /.spec.js/, // excluding .spec files
            loader: "uglify"
        }
    ]
}

You can pass UglifyJS parameters via 'uglify-loader' property of webpack config.

module: {
    loaders: [
        {
            // I want to uglify with mangling only app files, not thirdparty libs
            test: /.*\/app\/.*\.js$/,
            exclude: /.spec.js/, // excluding .spec files
            loader: "uglify"
        }
    ]
},
'uglify-loader': {
    mangle: false
}

Webpack 2

module: {
    rules: [
        {
            // I want to uglify with mangling only app files, not thirdparty libs
            test: /.*\/app\/.*\.js$/,
            exclude: /.spec.js/, // excluding .spec files
            use: 'uglify-loader'
        }
    ]
}

You can pass UglifyJS parameters via loader options.

module: {
    rules: [
        {
            // I want to uglify with mangling only app files, not thirdparty libs
            test: /.*\/app\/.*\.js$/,
            exclude: /.spec.js/, // excluding .spec files
            use: {
                loader: 'uglify-loader',
                options: {
                    mangle: false
                }
            }
        }
    ]
}

Readme

Keywords

Package Sidebar

Install

npm i es-uglify-loader

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

5.6 kB

Total Files

4

Last publish

Collaborators

  • zhouxiaoping