GithubHelp home page GithubHelp logo

webpack-contrib / uglifyjs-webpack-plugin Goto Github PK

View Code? Open in Web Editor NEW
1.4K 30.0 180.0 1.41 MB

[deprecated] UglifyJS Plugin

License: MIT License

JavaScript 100.00%
webpack-plugin webpack uglify minify minimizer

uglifyjs-webpack-plugin's Introduction

DEPRECATED

Please use https://github.com/webpack-contrib/terser-webpack-plugin

npm node deps tests cover chat size

UglifyJS Webpack Plugin

This plugin uses uglify-js to minify your JavaScript.

Requirements

This module requires a minimum of Node v6.9.0 and Webpack v4.0.0.

Getting Started

To begin, you'll need to install uglifyjs-webpack-plugin:

$ npm install uglifyjs-webpack-plugin --save-dev

Then add the plugin to your webpack config. For example:

webpack.config.js

const UglifyJsPlugin = require('uglifyjs-webpack-plugin');

module.exports = {
  optimization: {
    minimizer: [new UglifyJsPlugin()],
  },
};

And run webpack via your preferred method.

Options

test

Type: String|RegExp|Array<String|RegExp> Default: /\.js(\?.*)?$/i

Test to match files against.

webpack.config.js

module.exports = {
  optimization: {
    minimizer: [
      new UglifyJsPlugin({
        test: /\.js(\?.*)?$/i,
      }),
    ],
  },
};

include

Type: String|RegExp|Array<String|RegExp> Default: undefined

Files to include.

webpack.config.js

module.exports = {
  optimization: {
    minimizer: [
      new UglifyJsPlugin({
        include: /\/includes/,
      }),
    ],
  },
};

exclude

Type: String|RegExp|Array<String|RegExp> Default: undefined

Files to exclude.

webpack.config.js

module.exports = {
  optimization: {
    minimizer: [
      new UglifyJsPlugin({
        exclude: /\/excludes/,
      }),
    ],
  },
};

chunkFilter

Type: Function<(chunk) -> boolean> Default: () => true

Allowing to filter which chunks should be uglified (by default all chunks are uglified). Return true to uglify the chunk, false otherwise.

webpack.config.js

module.exports = {
  optimization: {
    minimizer: [
      new UglifyJsPlugin({
        chunkFilter: (chunk) => {
          // Exclude uglification for the `vendor` chunk
          if (chunk.name === 'vendor') {
            return false;
          }

          return true;
        },
      }),
    ],
  },
};

cache

Type: Boolean|String Default: false

Enable file caching. Default path to cache directory: node_modules/.cache/uglifyjs-webpack-plugin.

ℹ️ If you use your own minify function please read the minify section for cache invalidation correctly.

Boolean

Enable/disable file caching.

webpack.config.js

module.exports = {
  optimization: {
    minimizer: [
      new UglifyJsPlugin({
        cache: true,
      }),
    ],
  },
};

String

Enable file caching and set path to cache directory.

webpack.config.js

webpack.config.js

module.exports = {
  optimization: {
    minimizer: [
      new UglifyJsPlugin({
        cache: 'path/to/cache',
      }),
    ],
  },
};

cacheKeys

Type: Function<(defaultCacheKeys, file) -> Object> Default: defaultCacheKeys => defaultCacheKeys

Allows you to override default cache keys.

Default cache keys:

({
  'uglify-js': require('uglify-js/package.json').version, // uglify version
  'uglifyjs-webpack-plugin': require('../package.json').version, // plugin version
  'uglifyjs-webpack-plugin-options': this.options, // plugin options
  path: compiler.outputPath ? `${compiler.outputPath}/${file}` : file, // asset path
  hash: crypto
    .createHash('md4')
    .update(input)
    .digest('hex'), // source file hash
});

webpack.config.js

module.exports = {
  optimization: {
    minimizer: [
      new UglifyJsPlugin({
        cache: true,
        cacheKeys: (defaultCacheKeys, file) => {
          defaultCacheKeys.myCacheKey = 'myCacheKeyValue';

          return defaultCacheKeys;
        },
      }),
    ],
  },
};

parallel

Type: Boolean|Number Default: false

Use multi-process parallel running to improve the build speed. Default number of concurrent runs: os.cpus().length - 1.

ℹ️ Parallelization can speedup your build significantly and is therefore highly recommended.

Boolean

Enable/disable multi-process parallel running.

webpack.config.js

module.exports = {
  optimization: {
    minimizer: [
      new UglifyJsPlugin({
        parallel: true,
      }),
    ],
  },
};

Number

Enable multi-process parallel running and set number of concurrent runs.

webpack.config.js

module.exports = {
  optimization: {
    minimizer: [
      new UglifyJsPlugin({
        parallel: 4,
      }),
    ],
  },
};

sourceMap

Type: Boolean Default: false

Use source maps to map error message locations to modules (this slows down the compilation). If you use your own minify function please read the minify section for handling source maps correctly.

⚠️ cheap-source-map options don't work with this plugin.

webpack.config.js

module.exports = {
  optimization: {
    minimizer: [
      new UglifyJsPlugin({
        sourceMap: true,
      }),
    ],
  },
};

minify

Type: Function Default: undefined

Allows you to override default minify function. By default plugin uses uglify-js package. Useful for using and testing unpublished versions or forks.

⚠️ Always use require inside minify function when parallel option enabled.

webpack.config.js

module.exports = {
  optimization: {
    minimizer: [
      new UglifyJsPlugin({
        minify(file, sourceMap) {
          const extractedComments = [];

          // Custom logic for extract comments

          const { error, map, code, warnings } = require('uglify-module') // Or require('./path/to/uglify-module')
            .minify(file, {
              /* Your options for minification */
            });

          return { error, map, code, warnings, extractedComments };
        },
      }),
    ],
  },
};

uglifyOptions

Type: Object Default: default

UglifyJS minify options.

webpack.config.js

module.exports = {
  optimization: {
    minimizer: [
      new UglifyJsPlugin({
        uglifyOptions: {
          warnings: false,
          parse: {},
          compress: {},
          mangle: true, // Note `mangle.properties` is `false` by default.
          output: null,
          toplevel: false,
          nameCache: null,
          ie8: false,
          keep_fnames: false,
        },
      }),
    ],
  },
};

extractComments

Type: Boolean|String|RegExp|Function<(node, comment) -> Boolean|Object> Default: false

Whether comments shall be extracted to a separate file, (see details). By default extract only comments using /^\**!|@preserve|@license|@cc_on/i regexp condition and remove remaining comments. If the original file is named foo.js, then the comments will be stored to foo.js.LICENSE. The uglifyOptions.output.comments option specifies whether the comment will be preserved, i.e. it is possible to preserve some comments (e.g. annotations) while extracting others or even preserving comments that have been extracted.

Boolean

Enable/disable extracting comments.

webpack.config.js

module.exports = {
  optimization: {
    minimizer: [
      new UglifyJsPlugin({
        extractComments: true,
      }),
    ],
  },
};

String

Extract all or some (use /^\**!|@preserve|@license|@cc_on/i RegExp) comments.

webpack.config.js

module.exports = {
  optimization: {
    minimizer: [
      new UglifyJsPlugin({
        extractComments: 'all',
      }),
    ],
  },
};

RegExp

All comments that match the given expression will be extracted to the separate file.

webpack.config.js

module.exports = {
  optimization: {
    minimizer: [
      new UglifyJsPlugin({
        extractComments: /@extract/i,
      }),
    ],
  },
};

Function<(node, comment) -> Boolean>

All comments that match the given expression will be extracted to the separate file.

webpack.config.js

module.exports = {
  optimization: {
    minimizer: [
      new UglifyJsPlugin({
        extractComments: function(astNode, comment) {
          if (/@extract/i.test(comment.value)) {
            return true;
          }

          return false;
        },
      }),
    ],
  },
};

Object

Allow to customize condition for extract comments, specify extracted file name and banner.

webpack.config.js

module.exports = {
  optimization: {
    minimizer: [
      new UglifyJsPlugin({
        extractComments: {
          condition: /^\**!|@preserve|@license|@cc_on/i,
          filename(file) {
            return `${file}.LICENSE`;
          },
          banner(licenseFile) {
            return `License information can be found in ${licenseFile}`;
          },
        },
      }),
    ],
  },
};
condition

Type: Boolean|String|RegExp|Function<(node, comment) -> Boolean|Object>

Condition what comments you need extract.

webpack.config.js

module.exports = {
  optimization: {
    minimizer: [
      new UglifyJsPlugin({
        extractComments: {
          condition: 'some',
          filename(file) {
            return `${file}.LICENSE`;
          },
          banner(licenseFile) {
            return `License information can be found in ${licenseFile}`;
          },
        },
      }),
    ],
  },
};
filename

Type: Regex|Function<(string) -> String> Default: ${file}.LICENSE

The file where the extracted comments will be stored. Default is to append the suffix .LICENSE to the original filename.

webpack.config.js

module.exports = {
  optimization: {
    minimizer: [
      new UglifyJsPlugin({
        extractComments: {
          condition: /^\**!|@preserve|@license|@cc_on/i,
          filename: 'extracted-comments.js',
          banner(licenseFile) {
            return `License information can be found in ${licenseFile}`;
          },
        },
      }),
    ],
  },
};
banner

Type: Boolean|String|Function<(string) -> String> Default: /*! For license information please see ${commentsFile} */

The banner text that points to the extracted file and will be added on top of the original file. Can be false (no banner), a String, or a Function<(string) -> String> that will be called with the filename where extracted comments have been stored. Will be wrapped into comment.

webpack.config.js

module.exports = {
  optimization: {
    minimizer: [
      new UglifyJsPlugin({
        extractComments: {
          condition: true,
          filename(file) {
            return `${file}.LICENSE`;
          },
          banner(commentsFile) {
            return `My custom banner about license information ${commentsFile}`;
          },
        },
      }),
    ],
  },
};

warningsFilter

Type: Function<(warning, source) -> Boolean> Default: () => true

Allow to filter uglify-js warnings. Return true to keep the warning, false otherwise.

webpack.config.js

module.exports = {
  optimization: {
    minimizer: [
      new UglifyJsPlugin({
        warningsFilter: (warning, source) => {
          if (/Dropping unreachable code/i.test(warning)) {
            return true;
          }

          if (/filename\.js/i.test(source)) {
            return true;
          }

          return false;
        },
      }),
    ],
  },
};

Examples

Cache And Parallel

Enable cache and multi-process parallel running.

webpack.config.js

module.exports = {
  optimization: {
    minimizer: [
      new UglifyJsPlugin({
        cache: true,
        parallel: true,
      }),
    ],
  },
};

Preserve Comments

Extract all legal comments (i.e. /^\**!|@preserve|@license|@cc_on/i) and preserve /@license/i comments.

webpack.config.js

module.exports = {
  optimization: {
    minimizer: [
      new UglifyJsPlugin({
        uglifyOptions: {
          output: {
            comments: /@license/i,
          },
        },
        extractComments: true,
      }),
    ],
  },
};

Remove Comments

If you avoid building with comments, set uglifyOptions.output.comments to false as in this config:

webpack.config.js

module.exports = {
  optimization: {
    minimizer: [
      new UglifyJsPlugin({
        uglifyOptions: {
          output: {
            comments: false,
          },
        },
      }),
    ],
  },
};

Custom Minify Function

Override default minify function - use terser for minification.

webpack.config.js

module.exports = {
  optimization: {
    minimizer: [
      new UglifyJsPlugin({
        // Uncomment lines below for cache invalidation correctly
        // cache: true,
        // cacheKeys(defaultCacheKeys) {
        //   delete defaultCacheKeys['uglify-js'];
        //
        //   return Object.assign(
        //     {},
        //     defaultCacheKeys,
        //     { 'uglify-js': require('uglify-js/package.json').version },
        //   );
        // },
        minify(file, sourceMap) {
          // https://github.com/mishoo/UglifyJS2#minify-options
          const uglifyJsOptions = {
            /* your `uglify-js` package options */
          };

          if (sourceMap) {
            uglifyJsOptions.sourceMap = {
              content: sourceMap,
            };
          }

          return require('terser').minify(file, uglifyJsOptions);
        },
      }),
    ],
  },
};

Contributing

Please take a moment to read our contributing guidelines if you haven't yet done so.

CONTRIBUTING

License

MIT

uglifyjs-webpack-plugin's People

Contributors

ai avatar alexander-akait avatar arunoda avatar backjo avatar bebraw avatar bennybauer avatar brentwilton avatar davilima6 avatar dru89 avatar eugenehlushko avatar evilebottnawi avatar fa93hws avatar filipesilva avatar hartorn avatar hedgepigdaniel avatar hulkish avatar jdubois avatar jemarjones avatar jharris4 avatar joshwiens avatar julkue avatar jumoel avatar lencioni avatar michael-ciniawsky avatar mkarajohn avatar ooflorent avatar sebastians90 avatar skipjack avatar thelarkinn avatar zkat 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

uglifyjs-webpack-plugin's Issues

Please disable mangling by default

As you note in your README property mangling will probably break your code if you don't know how to use it, which is why your upstream UglifyJS disables it by default.

I don't understand what makes you, unlike your upstream, enable it by default, however. This cost me quite a bit of debugging time to figure out why our production build was arbitrarily breaking with a very niche thing in one of our dependencies.

Switch to uglify-es

Maybe it's time to switch to the uglify-es module, given how many new features are in the browser and node@8 these days that aren't supported in the existing uglify.

all folders missing from package on npm install

Version: master

Hi,

since you added ./dist/ to gitignore its not anymore included when installed via npm. The other folders aren't included either since you specified files: ["dist"] in package.json.

Greetings, Sascha

npm install -g webpack fails on docker container

Do you want to request a feature or report a bug?
Bug

What is the current behavior?
Command npm install -g webpack fails in a fresh ubuntu docker container. Please note npm install -g [email protected] worked

Error log:

root@1ee245bf5bd9:# npm install -g webpack
/root/.nvm/versions/node/v7.4.0/bin/webpack -> /root/.nvm/versions/node/v7.4.0/lib/node_modules/webpack/bin/webpack.js

> [email protected] postinstall /root/.nvm/versions/node/v7.4.0/lib/node_modules/webpack/node_modules/uglifyjs-webpack-plugin
> node lib/post_install.js

sh: 1: node: Permission denied
/root/.nvm/versions/node/v7.4.0/lib
`-- (empty)

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/webpack/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! Linux 4.9.4-moby
npm ERR! argv "/root/.nvm/versions/node/v7.4.0/bin/node" "/root/.nvm/versions/node/v7.4.0/bin/npm" "install" "-g" "webpack"
npm ERR! node v7.4.0
npm ERR! npm  v4.0.5
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn

npm ERR! [email protected] postinstall: `node lib/post_install.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the [email protected] postinstall script 'node lib/post_install.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the uglifyjs-webpack-plugin package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node lib/post_install.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs uglifyjs-webpack-plugin
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls uglifyjs-webpack-plugin
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /src/trimtool/ui/static/app/npm-debug.log

If the current behavior is a bug, please provide the steps to reproduce.

Do npm install -g webpack in a ubuntu docker container.

What is the expected behavior?
The webpack module should be installed.

Please mention other relevant information such as the browser version, Node.js version, webpack version and Operating System.

System Information :
Ubuntu

root@1ee245bf5bd9:# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.5 LTS
Release:        14.04
Codename:       trusty

NPM

root@1ee245bf5bd9:# npm --version
4.0.5

Node

root@1ee245bf5bd9:# node --version
v7.4.0

This issue was moved from webpack/webpack#5117 by @sokra. Orginal issue was by @thesellsword.

switch to uglify-es

Related somewhat to #32

get rid of all the "if using ES2017 install from git" etc, and switch to uglify-es only.

Uglify causes error in the angular 2 application only in IE, works fine in Chrome and FireFox

Uglify Package version 0.4.0
Node version 7.4.0
Angular Version 2.4.9
Typescript 2.0.0

IE version IE 11

I am running into a weird issue, I am not sure if it is an issue with my implementation or something else.

I am using this webpack plugin with grunt and when I uglify and try to access the code in IE it throws an error that a promise was not found and points to an html page referenced in the angular component. where as same code works perfectly fine in chrome and firefox.

if I don't uglify then code works fine all browsers.

I am confused as to what is going wrong with using uglify and IE.
I don't use any options on the uglify its just plain uglify.

Please verify and let me know if i am missing something in my configuration or its something else.

Thanks,
Naren

uglifyOptions aren't working – passing option without works

When I pass compress as a child of uglifyOptions the console statements will not be removed.

  config.plugins.push(new webpack.optimize.UglifyJsPlugin({
    uglifyOptions: {
      compress: {
        drop_console: true
      }
    }
  }));

But this works:

  config.plugins.push(new webpack.optimize.UglifyJsPlugin({
    compress: {
      drop_console: true
    }
  }));

I'm using Webpack v3.4.1.

[Angular CLI] options structure convention

I tried to use uglify-es with angular-cli (v "1.3.0-beta.1")
and switch to uglify-webpack-plugin version 1.0.0 -beta.1
I tried to play around with the options (modify mangle,sourcemap,comments)
and I saw that inside UglifyJsPlugin that there is no uglifyOptions property inside options just options
which lead to that the plugin will not recognized the options coming from webpack/angular-cli

 this.uglifyOptions = this.options.uglifyOptions || {};

[v1.0.0-beta.2] Doesn't support giving a {Function} (`options.extractComments`)

I've tried to extract comments via the Uglify plugin (latest version), which failed:

new webpack.optimize.UglifyJsPlugin({
    sourceMap: true,
    comments: function(astNode, comment) {
        return !!/(^@cc_on.*@)/i.test(comment.value);
    },
    extractComments: function(astNode, comment) {
        return !!/(?:^!|@(?:license|preserve))/i.test(comment.value);
    },
})

Although I have no minimal reproduction, it's obvious from the source code that the feature of providing a function as extractComments option was never implemented. Of course, there's always a small chance that I'm blind...

Unexpected token punc «(», expected punc when creating chunk from UglifyJs

I have the following error when trying to do a production build using webpack 2.2.1 :

> cross-env NODE_ENV=production webpack --config internals/webpack/webpack.prod.babel.js --color -p --progress

 Hash: 7bb2cdb98aab2f36f7e1                                                                 
Version: webpack 2.2.1
Time: 259158ms
                           Asset       Size  Chunks                    Chunk Names
39.1ac14d04bb54ae025fbd.chunk.js     575 kB      39  [emitted]  [big]  
                       .htaccess    1.53 kB          [emitted]         
                   manifest.json  624 bytes          [emitted]         
 0.b0881f3ea995a2fc465f.chunk.js     600 kB       0  [emitted]  [big]  
 1.350b2d8a46d91e3c0911.chunk.js     918 kB       1  [emitted]  [big]  
 2.e52c43dc81bf586e8812.chunk.js     636 kB       2  [emitted]  [big]  
 3.c7b3f0e5477649c6c9d3.chunk.js     646 kB       3  [emitted]  [big]  
 4.8ce7dfe0860e39ae2456.chunk.js     631 kB       4  [emitted]  [big]  
 5.d78c86c5b48b1b431c01.chunk.js     632 kB       5  [emitted]  [big]  
 6.9f79d2c5fa73cb97cc74.chunk.js     630 kB       6  [emitted]  [big]  
 7.3a675854451d716221c2.chunk.js     649 kB       7  [emitted]  [big]  
 8.5f09ba293a356e88feab.chunk.js     627 kB       8  [emitted]  [big]  
 9.edc7562575e48e9bce12.chunk.js     642 kB       9  [emitted]  [big]  
10.4a4bb6e69f6d7255d6ca.chunk.js     632 kB      10  [emitted]  [big]  
11.f5b5e0d36957300688bb.chunk.js     655 kB      11  [emitted]  [big]  
12.d2f74bd43695364d6e84.chunk.js     645 kB      12  [emitted]  [big]  
13.ab88bb5c89848d464643.chunk.js     628 kB      13  [emitted]  [big]  
14.cde57af54e53f5fa794f.chunk.js     626 kB      14  [emitted]  [big]  
15.df611a46991bdba9f78f.chunk.js     626 kB      15  [emitted]  [big]  
16.22d8ed2fc86438543bca.chunk.js     707 kB      16  [emitted]  [big]  
17.432aca8b104eb242add1.chunk.js     666 kB      17  [emitted]  [big]  
18.0c86d3404ce0d14653b2.chunk.js     650 kB      18  [emitted]  [big]  
19.d7636acc74397167013d.chunk.js     627 kB      19  [emitted]  [big]  
20.c3c519d8882f810910a6.chunk.js     632 kB      20  [emitted]  [big]  
21.fd6ec98dac51c188c629.chunk.js     708 kB      21  [emitted]  [big]  
22.200e5f939f77900a2f2f.chunk.js     643 kB      22  [emitted]  [big]  
23.393d2400f3a4357f1c2d.chunk.js     628 kB      23  [emitted]  [big]  
24.1c21a605f12ff9ff2fa7.chunk.js     634 kB      24  [emitted]  [big]  
25.5f5e33f51fe307545c6b.chunk.js     631 kB      25  [emitted]  [big]  
26.92502f109e3d6e616332.chunk.js     634 kB      26  [emitted]  [big]  
27.5d1ea5d6ebae15b96769.chunk.js     580 kB      27  [emitted]  [big]  
28.d571ed979e55c69096c2.chunk.js     579 kB      28  [emitted]  [big]  
29.c74d3346aca8532faf08.chunk.js     578 kB      29  [emitted]  [big]  
30.a35f7487c1c559c7f5d7.chunk.js     579 kB      30  [emitted]  [big]  
31.dc58b8286da5cbfefea3.chunk.js     567 kB      31  [emitted]  [big]  
32.6c32f4f35f9cda5c3938.chunk.js     587 kB      32  [emitted]  [big]  
33.ca86ec92b1a188a9c8e6.chunk.js     598 kB      33  [emitted]  [big]  
34.73c3e986500f888a12f5.chunk.js     571 kB      34  [emitted]  [big]  
35.59e71f89d6afcb9932bf.chunk.js     575 kB      35  [emitted]  [big]  
36.6285ac7b1164d4b53fc9.chunk.js     596 kB      36  [emitted]  [big]  
37.c301c304dd0bada883df.chunk.js     601 kB      37  [emitted]  [big]  
38.843bd7f01b202ca4d1bf.chunk.js     590 kB      38  [emitted]  [big]  
                     favicon.ico    67.3 kB          [emitted]         
40.db40e1c52ff3bad0bb78.chunk.js     586 kB      40  [emitted]  [big]  
41.cea7167bc8d0015ce8a3.chunk.js     576 kB      41  [emitted]  [big]  
42.4da525baabf2a11ff762.chunk.js     615 kB      42  [emitted]  [big]  
43.10dd5cb77bd71053c86a.chunk.js     569 kB      43  [emitted]  [big]  
44.dd2089c95eff121ed148.chunk.js     572 kB      44  [emitted]  [big]  
45.735f9eb7b75a9e0d5e3c.chunk.js     570 kB      45  [emitted]  [big]  
46.c691a6442ef58163ecb2.chunk.js     583 kB      46  [emitted]  [big]  
47.0bfb099e1d1bd4edff39.chunk.js     566 kB      47  [emitted]  [big]  
48.5ba43bcc43c12ecb8e4e.chunk.js    82.6 kB      48  [emitted]         
49.5a8172a8a9ef896cb1f5.chunk.js    35.5 kB      49  [emitted]         
50.0e982f73a5beb9ccad3a.chunk.js    36.3 kB      50  [emitted]         
51.8ab7ac85d02819586dc1.chunk.js    46.3 kB      51  [emitted]         
52.c8f155d9cef8f9f2937d.chunk.js    79.6 kB      52  [emitted]         
53.36c2fad479bf35b0d1f1.chunk.js    37.4 kB      53  [emitted]         
54.63e68a1593ab8ee4f2c6.chunk.js    36.3 kB      54  [emitted]         
55.8f657b8fdc6163d0550b.chunk.js    42.4 kB      55  [emitted]         
56.2a4cab26835a307d9468.chunk.js      35 kB      56  [emitted]         
57.ec95d3459dd932a74352.chunk.js    38.9 kB      57  [emitted]         
58.5e4c7da441e6c3244e25.chunk.js    18.2 kB      58  [emitted]         
59.50524fa7662caade7171.chunk.js    41.2 kB      59  [emitted]         
60.04694585a84e27f4b4a2.chunk.js    4.02 kB      60  [emitted]         
61.f532c12ec94650a77c36.chunk.js    4.11 kB      61  [emitted]         
62.0f7e16b18f11e6104300.chunk.js    4.91 kB      62  [emitted]         
63.04cd26a9cc98f6d2e251.chunk.js    4.86 kB      63  [emitted]         
64.28e531e8f67544ae8bb4.chunk.js    3.69 kB      64  [emitted]         
65.c6d529e00cc2f02d298d.chunk.js    4.11 kB      65  [emitted]         
66.9cd0049cdf2fae8311ac.chunk.js    6.84 kB      66  [emitted]         
67.8d860ceb8cfd8afec941.chunk.js    10.1 kB      67  [emitted]         
68.d511e394e401edc4742a.chunk.js    5.86 kB      68  [emitted]         
69.552c985835c018f52e83.chunk.js    12.4 kB      69  [emitted]         
70.f855bd5800a4d71c9e47.chunk.js     7.7 kB      70  [emitted]         
71.692364c8d68e9689e36c.chunk.js    24.1 kB      71  [emitted]         
72.38336d6626d6def72d84.chunk.js    24.4 kB      72  [emitted]         
73.b039a0a0b71d6645c37a.chunk.js    8.45 kB      73  [emitted]         
74.38e2ce6ee4774d0ce704.chunk.js    3.65 kB      74  [emitted]         
75.fd7b46e332d33698b270.chunk.js     6.4 kB      75  [emitted]         
76.6d6cf7ed17606711ae18.chunk.js    4.96 kB      76  [emitted]         
77.ebdbafe3da683a49d201.chunk.js    8.08 kB      77  [emitted]         
    main.89765ef68e927cffc5d6.js    1.41 MB      78  [emitted]  [big]  main
                      index.html  643 bytes          [emitted]         
                           sw.js    24.3 kB          [emitted]         
[./app/app.js] ./app/app.js 11.9 kB {78} [built]
[./app/containers/App/index.js] ./app/containers/App/index.js 7.38 kB {78} [built]
[./app/containers/App/selectors.js] ./app/containers/App/selectors.js 1.87 kB {78} [built]
[./app/containers/LanguageProvider/index.js] ./app/containers/LanguageProvider/index.js 7.01 kB {78} [built]
[./app/global-styles.js] ./app/global-styles.js 786 bytes {78} [built]
[./app/i18n.js] ./app/i18n.js 2.98 kB {78} [built]
[./app/routes.js] ./app/routes.js 26.9 kB {78} [built]
[./app/store.js] ./app/store.js 3.01 kB {78} [built]
[./node_modules/babel-polyfill/lib/index.js] ./~/babel-polyfill/lib/index.js 833 bytes {78} [built]
[./node_modules/intl/locale-data/jsonp/en.js] ./~/intl/locale-data/jsonp/en.js 24 kB {71} [built]
   [1] multi ./app/app.js 28 bytes {78} [built]
[./node_modules/react-dom/index.js] ./~/react-dom/index.js 59 bytes {78} [built]
[./node_modules/react-redux/lib/index.js] ./~/react-redux/lib/index.js 475 bytes {78} [built]
[./node_modules/react-router-redux/lib/index.js] ./~/react-router-redux/lib/index.js 1.97 kB {78} [built]
[./node_modules/sanitize.css/sanitize.css] ./~/sanitize.css/sanitize.css 856 bytes {78} [built]
    + 1207 hidden modules

ERROR in 1.350b2d8a46d91e3c0911.chunk.js from UglifyJs
Unexpected token punc «(», expected punc «:» [1.350b2d8a46d91e3c0911.chunk.js:20075,15]
Child html-webpack-plugin for "index.html":
    [./node_modules/html-webpack-plugin/lib/loader.js!./app/index.html] ./~/html-webpack-plugin/lib/loader.js!./app/index.html 588 bytes {0} [built]
Child __offline_serviceworker:
    [./node_modules/exports-loader/index.js?self.fetch!./node_modules/whatwg-fetch/fetch.js] ./~/exports-loader?self.fetch!./~/whatwg-fetch/fetch.js 12.6 kB {0} [built]
    [./node_modules/offline-plugin/empty-entry.js] ./~/offline-plugin/empty-entry.js 0 bytes {0} [built]
    [./node_modules/offline-plugin/lib/misc/sw-loader.js?json=%7B%22data_var_name%22%3A%22__wpo%22%2C%22loaders%22%3A%5B%5D%2C%22cacheMaps%22%3A%5B%5D%7D!./node_modules/offline-plugin/empty-entry.js] ./~/offline-plugin/lib/misc/sw-loader.js?json=%7B%22data_var_name%22%3A%22__wpo%22%2C%22loaders%22%3A%5B%5D%2C%22cacheMaps%22%3A%5B%5D%7D!./~/offline-plugin/empty-entry.js 16.2 kB {0} [built]

npm ERR! Linux 3.16.0-4-amd64
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build"
npm ERR! node v7.2.0
npm ERR! npm  v3.10.9
npm ERR! code ELIFECYCLE
npm ERR! [email protected] build: `cross-env NODE_ENV=production webpack --config internals/webpack/webpack.prod.babel.js --color -p --progress`
npm ERR! Exit status 2

I really don't know from where in my code it come from. I have just repared all the unit tests after month of non TDD development.

Is there a way to diagnosis this ?

Unhandled complicated object property key

File to be uglified:

var x = {
  a: 1,
  get "a-to-b" () {
    return this.a
  }
}

console.log(x['a-to-b'])

Using uglify fileToBeUglified.js -o uglified.js, get:

var x={a:1,get a-to-b(){return this.a}};console.log(x["a-to-b"]);

Will throw Uncaught SyntaxError: Unexpected token - error.

SyntaxError: Cannot declare a let variable twice

I'm running OS X, node 7.4.0, and transpile my JS using babel preset ES2015. I got the following error when running v0.4.6:

ERROR in bundle.js from UglifyJs
Name expected [bundle.js:25358,6]

After upgrading to v.1.0.0-beta.1 this error was fixed, but somehow, the following error appear on Safari:

SyntaxError: Cannot declare a let variable twice: 'e'.

Any clues to why this is?
Thanks!

Update plugin

Several commits have been applied to the plugin in webpack/webpack, so we should update it here as well.

Simply copying the new version will lead to a bunch of linting errors, because the projects use different eslint configurations.

Why uglifyjs-webpack-plugin + uglify-es doesn't work?

I use uglifyjs-webpack-plugin and uglify-es to uglify my js code.

package.json

  "devDependencies":  {
    "uglify-es": "^3.0.24",
    "uglifyjs-webpack-plugin": "^0.4.6",
    "webpack": "^3.0.0",
  },

webpack.prod.js

const Merge = require('webpack-merge');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const CommonConfig = require('./webpack.common.js');

module.exports = Merge(CommonConfig, {
  plugins: [
    new UglifyJSPlugin({
      beautify: false,
      mangle: {
        screw_ie8: true,
        keep_fnames: true,
      },
      compress: {
        screw_ie8: true,
      },
      comments: false,
      sourceMap: true,
    }),
  ],
  devtool: 'source-map',
});

OS Version: Linux Garfield550 4.4.0-43-Microsoft #1-Microsoft Wed Dec 31 14:42:53 PST 2014 x86_64 x86_64 x86_64 GNU/Linux

Node.js Version: v8.1.3

I get an build error was:

ERROR in /js/vendor.js from UglifyJs
Unexpected character '`' [./node_modules/foundation-sites/js/foundation.util.core.js:24,0][/js/vendor.js:10446,124]

webpack 3 is missing uglify v2.x dependency which breaks the build

Do you want to request a feature or report a bug?
bug

What is the current behavior?
I'm getting the following error:

ERROR in bundle-main.js from UglifyJs
TypeError: Cannot read property 'reset' of undefined
    at /Users/user/project/node_modules/uglifyjs-webpack-plugin/dist/index.js:96:21
    at Array.forEach (native)
    at Compilation.<anonymous> (/Users/user/project/node_modules/uglifyjs-webpack-plugin/dist/index.js:54:20)
    at Compilation.applyPluginsAsyncSeries (/Users/user/project/node_modules/tapable/lib/Tapable.js:142:13)
    at self.applyPluginsAsync.err (/Users/user/project/node_modules/webpack/lib/Compilation.js:641:10)
    at next (/Users/user/project/node_modules/tapable/lib/Tapable.js:138:11)
    at ExtractTextPlugin.<anonymous> (/Users/user/project/node_modules/extract-text-webpack-plugin/index.js:345:4)
    at Compilation.applyPluginsAsyncSeries (/Users/user/project/node_modules/tapable/lib/Tapable.js:142:13)
    at sealPart2 (/Users/user/project/node_modules/webpack/lib/Compilation.js:637:9)
    at next (/Users/user/project/node_modules/tapable/lib/Tapable.js:138:11)
    at ExtractTextPlugin.<anonymous> (/Users/user/project/node_modules/extract-text-webpack-plugin/index.js:317:5)
    at /Users/user/project/node_modules/async/dist/async.js:421:16
    at iteratorCallback (/Users/user/project/node_modules/async/dist/async.js:998:13)
    at /Users/user/project/node_modules/async/dist/async.js:906:16
    at /Users/user/project/node_modules/extract-text-webpack-plugin/index.js:301:6
    at /Users/user/project/node_modules/async/dist/async.js:421:16
    at iteratorCallback (/Users/user/project/node_modules/async/dist/async.js:998:13)
    at /Users/user/project/node_modules/async/dist/async.js:906:16
    at /Users/user/project/node_modules/extract-text-webpack-plugin/index.js:298:13
    at /Users/user/project/node_modules/async/dist/async.js:3060:16
    at eachOfArrayLike (/Users/user/project/node_modules/async/dist/async.js:1003:9)
    at eachOf (/Users/user/project/node_modules/async/dist/async.js:1051:5)
    at Object.eachLimit (/Users/user/project/node_modules/async/dist/async.js:3122:5)

I'm pretty sure this is because webpack 2.6 had "uglify-js": "^2.8.27" as a dependency, but webpack 3.0 has only "uglifyjs-webpack-plugin": "^0.4.4" as a dependency (which does NOT pull in uglify-js v2!)

If the current behavior is a bug, please provide the steps to reproduce.

It seems to be occurring whenever I use the -p option from the CLI.

What is the expected behavior?
Errors should not occur when using minification via uglify js.

If this is a feature request, what is motivation or use case for changing the behavior?

Please mention other relevant information such as the browser version, Node.js version, webpack version and Operating System.
Webpack 3.0
Node 8.1.2
MacOS 10.12.5


This issue was moved from webpack/webpack#5092 by @sokra. Orginal issue was by @jharris4.

uglifyjs-webpack-plugin should have uglify-js as dependency

Unexpected token name «i», expected punc «;»

Running into issues when using babel and uglifyjs together. Getting this error on compilation:

$ npm run build

> [email protected] build C:\Projects\uglifyjs-bug-report
> webpack

Hash: 59b8aeb1c10604620688
Version: webpack 3.1.0
Time: 738ms
       Asset    Size  Chunks             Chunk Names
    index.js  138 kB       0  [emitted]  main
index.js.map  164 kB       0  [emitted]  main
   [0] (webpack)/buildin/global.js 509 bytes {0} [built]
   [1] ./src/index.js 197 bytes {0} [built]
   [9] (webpack)/buildin/module.js 517 bytes {0} [built]
    + 7 hidden modules

ERROR in index.js from UglifyJs
Unexpected token name «i», expected punc «;» [./node_modules/isemail/lib/index.js:116,0][index.js:226,13]

Compiling without UglifyJS completes without errors.

The isemail library works standalone, but with the babel trnasformation, UglifyJS throws the error above.

Here is a reproduction repository:
https://github.com/AlesMenzel/uglifyjs-bug-report

Node: 8.1.2
NPM: 5.1.0
Webpack: 3.1.0

Cannot read property 'reset' of undefined

ERROR in bundle.js from UglifyJs
TypeError: Cannot read property 'reset' of undefined
    at F:\Github\Program\My-test\Webpack\www2\node_modules\[email protected]@uglifyjs-webpack-plugin\dist\index.js:99:22
    at F:\Github\Program\My-test\Webpack\www2\node_modules\[email protected]@uglifyjs-webpack-plugin\dist\index.js:231:9
    at Array.forEach (native)
    at Compilation.<anonymous> (F:\Github\Program\My-test\Webpack\www2\node_modules\[email protected]@uglifyjs-webpack-plugin\dist\index.js:54:19)
    at Compilation.applyPluginsAsyncSeries (F:\Github\Program\My-test\Webpack\www2\node_modules\[email protected]@tapable\lib\Tapable.js:142:13)
    at self.applyPluginsAsync.err (F:\Github\Program\My-test\Webpack\www2\node_modules\[email protected]@webpack\lib\Compilation.js:635:10)
    at next (F:\Github\Program\My-test\Webpack\www2\node_modules\[email protected]@tapable\lib\Tapable.js:138:11)
    at Compilation.compilation.plugin.callback (F:\Github\Program\My-test\Webpack\www2\node_modules\[email protected]@webpack\lib\ProgressPlugin.js:113:6)
    at Compilation.applyPluginsAsyncSeries (F:\Github\Program\My-test\Webpack\www2\node_modules\[email protected]@tapable\lib\Tapable.js:142:13)
    at sealPart2 (F:\Github\Program\My-test\Webpack\www2\node_modules\[email protected]@webpack\lib\Compilation.js:631:9)
    at next (F:\Github\Program\My-test\Webpack\www2\node_modules\[email protected]@tapable\lib\Tapable.js:138:11)
    at Compilation.compilation.plugin (F:\Github\Program\My-test\Webpack\www2\node_modules\[email protected]@webpack\lib\ProgressPlugin.js:109:6)
    at Compilation.applyPluginsAsyncSeries (F:\Github\Program\My-test\Webpack\www2\node_modules\[email protected]@tapable\lib\Tapable.js:142:13)
    at Compilation.seal (F:\Github\Program\My-test\Webpack\www2\node_modules\[email protected]@webpack\lib\Compilation.js:579:8)
    at F:\Github\Program\My-test\Webpack\www2\node_modules\[email protected]@webpack\lib\Compiler.js:493:16
    at F:\Github\Program\My-test\Webpack\www2\node_modules\[email protected]@tapable\lib\Tapable.js:225:11
    at _addModuleChain (F:\Github\Program\My-test\Webpack\www2\node_modules\[email protected]@webpack\lib\Compilation.js:481:11)
    at processModuleDependencies.err (F:\Github\Program\My-test\Webpack\www2\node_modules\[email protected]@webpack\lib\Compilation.js:452:13)
    at _combinedTickCallback (internal/process/next_tick.js:73:7)
    at process._tickCallback (internal/process/next_tick.js:104:9)

What's 'reset' mean?

feature: Add logic to ensure only 1 UglifyJsPlugin's instance per compiler

Problem:

Currently, I think it's too easy to accidentally apply 2 instances of UglifyJsPlugin to the same compiler/compilation.

Scenario:

  • You are a webpack newb
  • You need to make a production build
  • You learn UglifyJsPlugin is the recommended way to minify your bundle, so you make a webpack.config.prod.js and include UglifyJsPlugin.
  • You learn that it's recommended to use the --optimize-minimize/-p argument with webpack cli, so u make a production build script:
"scripts": {
  "build:prod": "webpack -p"
}

Since this webpack cli option auto-adds the UglifyJsPlugin:

  • You now have attached 2 separate instances of the same plugin.
  • Your production build is 'gon be sloowwwwww

Solution

Add a guard to the top of UglifyJsPlugin class method apply which restricts multiple instances of the plugin from being applied to the same compiler, like so:

class UglifyJsPlugin {
  static appliedCompilers = new WeakSet();

  // then use it as a guard:
  apply(compiler) {
    if (UglifyJsPlugin.appliedCompilers.has(compiler)) return;
    appliedCompilers.add(compiler);
    [...]
  }
}

"But... that's user error"

Yes, it absolutely is. However, I have personally come across the mistake several times. My thinking is... the negative impact this potentially introduces is worth safeguarding against.

Dependency problem

module.js:472
throw err;
^

Error: Cannot find module 'webpack/lib/RequestShortener'
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object. (/Users/HAL/Lab/lab/progressive/node_modules/uglifyjs-webpack-plugin/dist/index.js:17:24)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)

I ran:
yarn add uglifyjs-webpack-plugin --dev ( version "uglifyjs-webpack-plugin": "^0.4.3")

cheap-source-map doesn't work

It looks to be incompatible with sourceMap. I use the following versions:

    "uglifyjs-webpack-plugin": "^0.3.1",
    "webpack": "2.3.2",
    "uglify-js": "^2.8.18",

Config:

        devtool: 'cheap-source-map',
...
                new UglifyJSPlugin({
                        sourceMap: true
                })

Missing commons in manifest when using UglifyJS

Hi,

For some reason when I use UglifyJS with webpack-php-manifest, I am missing my commons bundle. Does anyone know why this may be?

Thanks,
Andy

var webpack = require('webpack');
var path = require('path');

var WebpackNotifierPlugin = require('webpack-notifier');
var ExtractTextPlugin = require("extract-text-webpack-plugin");

var UglifyJSPlugin = require('uglifyjs-webpack-plugin');
var UglifyJS = new UglifyJSPlugin();

var PhpManifestPlugin = require('webpack-php-manifest');
var phpManifest = new PhpManifestPlugin();

var cssConfig = ExtractTextPlugin.extract({
    use: [{
        loader: "css-loader?sourceMap!autoprefixer-loader"
    }, {
        loader: "autoprefixer-loader"
    }, {
        loader: "sass-loader?sourceMap!autoprefixer-loader",
    }],
    // use style-loader in development
    fallback: "style-loader"
});

var notifier = new WebpackNotifierPlugin({
        title: "Production bundler",
        alwaysNotify: true
    });

var jqueryPlugin = new webpack.ProvidePlugin({
        $: "jquery",
        jQuery: "jquery",
        "window.jQuery": "jquery",
        "window.$": "jquery"
    });

var extractTextConfig = new ExtractTextPlugin({
        filename: "[name]/styles.[chunkhash].css",
        ignoreOrder: true,
        allChunks: true
    });

var commonsPlugin =  new webpack.optimize.CommonsChunkPlugin({name: "commons",filename: "commons.[chunkhash].min.js", minChunks: 2});

const APP = path.join(__dirname, "dev");
const PUBLIC = path.join(__dirname, "public");

module.exports = {
    node: {
        fs: 'empty',
    },
    context: APP,
    devtool: "source-map",
    entry: {
        assets: "./assets/js/index.js",
        commercial: "./commercial/js/index.js",
        customers: "./customers/js/index.js",
        documents: "./documents/js/index.js",
        estates: "./estates/js/index.js",
        login: "./login/js/index.js",
        messages: "./messages/js/index.js",
        portal: "./portal/js/index.js",
        procurement: "./procurement/js/index.js",
        projects: "./projects/js/index.js",
        reports: "./reports/js/index.js",
        resources: "./resources/js/index.js"
    },
    output: {
        path: PUBLIC,
        publicPath: "/",
        filename: "[name]/bundle.[chunkhash].min.js"
    },
    resolve: {
        extensions: [".js",".scss", ".css", ".json"]
    },
    module: {
        loaders: [
            {
                test: /\.js$/,
                loaders: 'babel-loader?cacheDirectory',
                include: APP
            },
            {
                test: /\.json$/,
                loader: 'json-loader'
            },
            {
                test: /\.s?css$/,
                use: cssConfig,
                include: APP
            }
            , {
                test: /\.(png|woff|woff2|eot|ttf|svg|jpg|gif)$/,
                loader: 'url-loader?limit=1000&name=_shared/img/dist/[name].[ext]'
            }
        ]
    },
    plugins: [
        UglifyJS,
        extractTextConfig,
        jqueryPlugin,
        notifier,
        commonsPlugin,
        phpManifest
    ]

}

Support UglifyJS 3

Currently using UglifyJS 3 breaks the plugin. It has a new API so the plugin has to change accordingly.

npm (Node.js <7.1) bug prevents from developing using 'npm link'

Although not a bug of this project, I thought I would share my findings here. I've been mostly developing with the latest LTS version of Node.js (currently 6.9.4), but it seems there is a bug in versions prior to 7.1 that prevents resolving peer dependencies when using npm link due to issues with symlinks.

The solution is to run the linked project with Node.js >= 7.1 and either --preserve-symlinks flag or NODE_PRESERVE_SYMLINKS=1 environment variable.

npm/npm#5875
npm/npm#5080
https://nodejs.org/api/cli.html#cli_preserve_symlinks

Building and publishing the lib

@bebraw If I understood correctly, "build" script should be run automatically when npm installing the lib. So, do we want the build step happening at the user side, or should we instead provide minified bundle, e.g. under ./dist (I think lib is for external dependencies, not builds)?

By the way, when I install the lib locally to another project with npm install ../uglifyjs-webpack-plugin, the build script is not being executed, and consequently I am missing lib directory, unless I have already executed npm run build in ../uglifyjs-webpack-plugin. Is this expected behavior?

Is it fine if we target ES6, i.e. not transpiling into ES5? So, basically we would be publishing the lib as a minified ES6 bundle.

Noticed also that there is another project with the same goal: https://github.com/Akkuma/webpack-uglify-harmony

docs(README): `UglifyJS v3` should be `uglify-es`

The current README states:

This plugin uses UglifyJS v3 to minify your JavaScript

That is incorrect.

uglify-js@3 only handles ES5, whereas uglify-es handles ES6+.

The README should state:

This plugin uses uglify-es to minify your JavaScript

webpack-defaults upgrade

Addition of webpack-defaults & associated refactoring as a part of the next Major release

Issue exists for status tracking across the organization.

Please do not close

can not support es6 minification after upgrade to 0.4.6

the 0.4.6 version move the uglify2 to dependencies, so I can't specify the uglify2 version through yarn add git://github.com/mishoo/UglifyJS2#harmony-v2.8.22 --dev. cause the plugin will use its own dependency - uglify-js^2.8.29.

Identifiers in JSX attributes not being uglified

Do you want to request a feature or report a bug?

bug

What is the current behavior?

Uglify fails to process some identifiers.

I recently upgraded a React/Redux/TypeScript project from TypeScript 2.2 + Babel + Webpack 2.2 to TypeScript 2.3.2 + Webpack 2.5.1. This project makes heavy use of Immutable and i18next.

After the uglify process, my client.js bundle had exactly one reference to i18next_1.t and immutable_1.fromJS, which is odd because I use both all over the app. Both of these caused errors in the browser because i18next and immutable were undefined (the real ones had been uglified).

If the current behavior is a bug, please provide the steps to reproduce.

The two instances shared a few attributes:

  • they were both referenced from within a JSX attribute
  • they were both from a stateless React component

e.g. UglifyJSPlugin fails on this code (note that TypeScript changes the "t" in placeholder to be i18next_1.t)

import { t } from 'i18next';

export const TitleField = ({ input }: any) =>
    <input id="title" maxLength={ 32 } type="text" { ...input } placeholder={ t("TITLE_PLACEHOLDER") } autoFocus={ true }/>
;

However, it worked when I rewrote the component to have the function call outside of the JSX attribute:

import { t } from 'i18next';

export const TitleField = ({ input }: any) => {
    const placeholder = t("TITLE_PLACEHOLDER");
    return (
        <input id="title" maxLength={ 32 } type="text" { ...input } placeholder={ placeholder } autoFocus={ true }/>
    );
};

What is the expected behavior?

Identifier should be uglified

If this is a feature request, what is motivation or use case for changing the behavior?

n/a

Please mention other relevant information such as the browser version, Node.js version, webpack version and Operating System.

webpack v2.5.1
TypeScript v2.3.2
npm v4.0.5
node v6.9.4
Windows 7

Expose chunk to `options.<test|include|exclude>`

The test, include and exclude options only inspect the output filename, which has no value when the names are like [hash].[ext]. It would be very helpful to expose the associated chunk info as well.

broken in webpack 3

Argument spreading is broken in uglify-js. This worked fine in rc of 3.0.0

"uglifyjs-webpack-plugin": "^0.4.6",
"webpack": "^3.0.0",

It is not using concat to spread the arguments when called in a function causing a ton of problems.

Object.keys(selected).reduce((...args) => {
    console.log('reduction: ', args, args.length);
    return handleProcessReduction(selected, ...args);
  }, {});

In the above code, args is sent to handleProcessReduction as the second arg only.

Looking at the transpiled code:

return Object.keys(e).reduce(function() {
            for (var r = arguments.length, t = Array(r), n = 0; n < r; n++)
              t[n] = arguments[n];
            return console.log(
              'reduction: ',
              t,
              t.length,
            ), u.apply(void 0, [e, t]); // <---- t should have been spread [e].concat(t)
          }, {});

Conceptual question: Why is this is a plugin?

I'm just trying to better understand the Webpack ecosystem, and the way I had the difference between a plugin and a loader arranged in my head was that a loader is a String -> String transformation, and plugins are used when you are adding functionality to Webpack.

Given that definition, why is this a plugin instead of a loader?

  • Is my definition wrong?
  • Am I wrong in assuming that uglifying a file is a String -> String transformation
  • Is it just a plugin for legacy reasons?
  • Is it because it ideally would be a loader, but it requires some plugin functionality that loaders can't do?

Uglify not uglifyin in webpack

Hi,

I'm trying to use Webpack with the uglify plugin inside docker to package the Javascript I use ready for release.

There are no errors - but the Javascript just doesn't seem to be Uglified ever.

I have a simple docker box here that contains a simple setup, that I would have expected to produce uglified Javascript output.

I realise that there is a high chance of pebkac, but I would still appreciate someone pointing out what needs to be changed to make it work.

Node version: 7.10.0

OS version from uname -a
Linux 9fe30035f921 4.9.27-moby #1 SMP Thu May 11 04:01:18 UTC 2017 x86_64 GNU/Linux

I would expect the output for the test code from webpack + uglify to look like this:

function really_long_test_function_name(a,p){var d=a+"asdjpajdpoadpsapodjpasojdpoajpdoaspdpasjd";return(d+(d+(d+(d+(d+(d+(d+(p+"asdjpajdpoadpsapodjpasojdpoajpdoaspdpasjd")))))))).length}

The built output/main.js doesn't look minified at all:

***SNIPPED***
function(module,exports){eval('// compress_test.js\nfunction really_long_test_function_name(some_really_long_param_name_1, some_really_long_param_name_2) {\n\n\n    var foo_really_long_var_name_1 = some_really_long_param_name_1 + "asdjpajdpoadpsapodjpasojdpoajpdoaspdpasjd";\n    var foo_really_long_var_name_2 = some_really_long_param_name_2 + "asdjpajdpoadpsapodjpasojdpoajpdoaspdpasjd";\n\n    var foo_really_long_var_name_3 = foo_really_long_var_name_1 + foo_really_long_var_name_2;\n    var foo_really_long_var_name_4 = foo_really_long_var_name_1 + foo_really_long_var_name_3;\n    var foo_really_long_var_name_5 = foo_really_long_var_name_1 + foo_really_long_var_name_4;\n    var foo_really_long_var_name_6 = foo_really_long_var_name_1 + foo_really_long_var_name_5;\n    var foo_really_long_var_name_7 = foo_really_long_var_name_1 + foo_really_long_var_name_6;\n    var foo_really_long_var_name_8 = foo_really_long_var_name_1 + foo_really_long_var_name_7;\n    var foo_really_long_var_name_9 = foo_really_long_var_name_1 + foo_really_long_var_name_8;\n\n\n    return foo_really_long_var_name_9.length;\n}//# sourceMappingURL=*SNIPPED*==')}]);

i.e. the output from webpack just seems to be the original code.

[v1.0.0-beta.2] @license comments aren't removed

I was trying out the latest beta (v1.0.0-beta.2), but it is not working for me. I also reverted back to v.0.4.6 but that version works.

vue git:(develop) ✗ npm run build

> [email protected] build /../vue
> cross-env NODE_ENV=production webpack --config webpack.prod.config.js --progress --hide-modules

/../vue/node_modules/schema-utils/dist/validateOptions.js:40
    throw new _ValidationError2.default(ajv.errors, name);
    ^

false
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `cross-env NODE_ENV=production webpack --config webpack.prod.config.js --progress --hide-modules`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

webpack.config.js

const UglifyJSPlugin = require('uglifyjs-webpack-plugin');

if (process.env.NODE_ENV === 'production') {

  config.plugins.push(
      
      //Define production environment
      new webpack.DefinePlugin({
        'process.env': {
          NODE_ENV: '"production"'
        }
      }),
      //https://www.npmjs.com/package/assets-webpack-plugin
      new AssetsPlugin({
        filename: 'webpack.assets.json',
        fullPath: false,
        prettyPrint: true,
        path: path.join(__dirname)
      }),
      //Extract CSS from JS files
      new ExtractTextPlugin({
        filename: '[name].[hash].min.css',
        allChunks: true
      }),
      new OptimizeCssAssetsPlugin({
        assetNameRegExp: /\.css$/g,
          cssProcessor: require('cssnano'),
          cssProcessorOptions: {
          discardComments: {
            removeAll: true
          },
          reduceIdents: false,
        },
        canPrint: true
      }),
      new webpack.LoaderOptionsPlugin({
        minimize: true
      }),
      new UglifyJSPlugin({
        compress: {
          warnings: false,
        },
        output: {
          comments: false
        },
        sourceMap: true
      })
  );

  module.exports = config;
}

Versions:

➜  vueV git:(develop) ✗ npm -v
5.3.0
➜  vueV git:(develop) ✗ node -v
v8.1.2
➜  vueV git:(develop) ✗ yarn version
yarn version v0.27.5

[v1.0.0] Release Date (?)

First off I wanted to say thank you for all of the excellent work!
I've been playing with the v1.0.0-beta.2 release for the past week and its incredibly fast + pleasant to use.

I was wondering if there was any rough timeline for when 1.0 would get out of beta? Would you guess on the order of days/weeks or months?

Thanks!

`include` isn't currently working

I'm unfamiliar with the history of the include option. So, I went looking and couldn't find a single mention of it in source code of uglifyjs-webpack-plugin, uglify-es or uglify-js.

Update: I've since learned it comes from webpack/lib/ModuleFilenameHelpers's ModuleFilenameHelpers.matchObject() method. The problem, however is that include/exclude really only applies to compilation.assets.

So to make this fully functional IMO, (feature?) - we should probably implement #21. Which would allow us to match against module paths.

I wrote this test to prove it:

import UglifyJsPlugin from '../src/index';
import {
  cleanErrorStack,
  createCompiler,
  compile,
} from './helpers';

describe('when applied with include option', () => {
  it('matches snapshot', () => {
    const compiler1 = createCompiler();
    const compiler2 = createCompiler();
    new UglifyJsPlugin().apply(compiler1);
    new UglifyJsPlugin({
      uglifyOptions: {
        include: /foo\.js$/,
        compress: true,
      },
    }).apply(compiler2);

    return Promise.all([
      compile(compiler1).then((stats) => {
        const errors = stats.compilation.errors.map(cleanErrorStack);
        const warnings = stats.compilation.warnings.map(cleanErrorStack);

        expect(errors).toMatchSnapshot('errors');
        expect(warnings).toMatchSnapshot('warnings');

        for (const file in stats.compilation.assets) {
          if (Object.prototype.hasOwnProperty.call(stats.compilation.assets, file)) {
            expect(stats.compilation.assets[file].source()).toMatchSnapshot(file);
          }
        }

        return stats;
      }),
      compile(compiler2).then((stats) => {
        const errors = stats.compilation.errors.map(cleanErrorStack);
        const warnings = stats.compilation.warnings.map(cleanErrorStack);

        expect(errors).toMatchSnapshot('errors');
        expect(warnings).toMatchSnapshot('warnings');

        for (const file in stats.compilation.assets) {
          if (Object.prototype.hasOwnProperty.call(stats.compilation.assets, file)) {
            expect(stats.compilation.assets[file].source()).toMatchSnapshot(file);
          }
        }

        return stats;
      }),
    ]).then(([stats1, stats2]) => {
      expect(Object.keys(stats1)).toEqual(Object.keys(stats2));

      for (const file in stats1.compilation.assets) {
        if (Object.prototype.hasOwnProperty.call(stats1.compilation.assets, file)) {
          expect(stats1.compilation.assets[file].source()).toEqual(stats2.compilation.assets[file].source());
        }
      }
    });
  });
});

This outputs a snapshot:

// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`errors 1`] = `Array []`;

exports[`errors 2`] = `Array []`;

exports[`main.0c220ec66316af2c1b24.js 1`] = `"webpackJsonp([0],[function(o,n){o.exports=function(){console.log(7)}}],[0]);"`;

exports[`main.0c220ec66316af2c1b24.js 2`] = `"webpackJsonp([0],[function(o,n){o.exports=function(){console.log(7)}}],[0]);"`;

exports[`manifest.6afe1bc6685e9ab36c1c.js 1`] = `"!function(e){function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}var r=window.webpackJsonp;window.webpackJsonp=function(t,c,a){for(var i,u,f,l=0,s=[];l<t.length;l++)u=t[l],o[u]&&s.push(o[u][0]),o[u]=0;for(i in c)Object.prototype.hasOwnProperty.call(c,i)&&(e[i]=c[i]);for(r&&r(t,c,a);s.length;)s.shift()();if(a)for(l=0;l<a.length;l++)f=n(n.s=a[l]);return f};var t={},o={1:0};n.e=function(e){function r(){i.onerror=i.onload=null,clearTimeout(u);var n=o[e];0!==n&&(n&&n[1](new Error(\\"Loading chunk \\"+e+\\" failed.\\")),o[e]=void 0)}var t=o[e];if(0===t)return new Promise(function(e){e()});if(t)return t[2];var c=new Promise(function(n,r){t=o[e]=[n,r]});t[2]=c;var a=document.getElementsByTagName(\\"head\\")[0],i=document.createElement(\\"script\\");i.type=\\"text/javascript\\",i.charset=\\"utf-8\\",i.async=!0,i.timeout=12e4,n.nc&&i.setAttribute(\\"nonce\\",n.nc),i.src=n.p+\\"\\"+e+\\".\\"+({0:\\"main\\"}[e]||e)+\\".\\"+{0:\\"0c220ec66316af2c1b24\\"}[e]+\\".js\\";var u=setTimeout(r,12e4);return i.onerror=i.onload=r,a.appendChild(i),c},n.m=e,n.c=t,n.d=function(e,r,t){n.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:t})},n.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(r,\\"a\\",r),r},n.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},n.p=\\"\\",n.oe=function(e){throw console.error(e),e}}([]);"`;

exports[`manifest.6afe1bc6685e9ab36c1c.js 2`] = `"!function(e){function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}var r=window.webpackJsonp;window.webpackJsonp=function(t,c,a){for(var i,u,f,l=0,s=[];l<t.length;l++)u=t[l],o[u]&&s.push(o[u][0]),o[u]=0;for(i in c)Object.prototype.hasOwnProperty.call(c,i)&&(e[i]=c[i]);for(r&&r(t,c,a);s.length;)s.shift()();if(a)for(l=0;l<a.length;l++)f=n(n.s=a[l]);return f};var t={},o={1:0};n.e=function(e){function r(){i.onerror=i.onload=null,clearTimeout(u);var n=o[e];0!==n&&(n&&n[1](new Error(\\"Loading chunk \\"+e+\\" failed.\\")),o[e]=void 0)}var t=o[e];if(0===t)return new Promise(function(e){e()});if(t)return t[2];var c=new Promise(function(n,r){t=o[e]=[n,r]});t[2]=c;var a=document.getElementsByTagName(\\"head\\")[0],i=document.createElement(\\"script\\");i.type=\\"text/javascript\\",i.charset=\\"utf-8\\",i.async=!0,i.timeout=12e4,n.nc&&i.setAttribute(\\"nonce\\",n.nc),i.src=n.p+\\"\\"+e+\\".\\"+({0:\\"main\\"}[e]||e)+\\".\\"+{0:\\"0c220ec66316af2c1b24\\"}[e]+\\".js\\";var u=setTimeout(r,12e4);return i.onerror=i.onload=r,a.appendChild(i),c},n.m=e,n.c=t,n.d=function(e,r,t){n.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:t})},n.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(r,\\"a\\",r),r},n.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},n.p=\\"\\",n.oe=function(e){throw console.error(e),e}}([]);"`;

exports[`warnings 1`] = `Array []`;

exports[`warnings 2`] = `Array []`;

As you can see, it is ignoring the include option entirely and uglifying everything (identical compilation output for both). Is this still a desired feature?

This also makes me wonder; are there other options are obsolete/no longer working?

UpdateI think this is also true for the test/exclude options.

[v1.0.0-beta.2] parallelization isn't working

Well I was hacking next.js and tried to play with the new toy in town

I attempted to remove the old uglifyJs from webpack and installed the beta version back into the plugins config in wepback:

removeUglifyJsPlugin () {
  // create a clone of config.plugins without UglifyJsPlugin
  delete this.config.plugins.filter(p => p.constructor.name === 'UglifyJsPlugin')[0]
  this.config.plugins = this.config.plugins.filter(p => p.constructor.name !== 'UglifyJsPlugin')

  return this
}

addUglifyEsPlugin (opts) {
  const plugin = new UglifyJSPlugin({
    parallel: true,
    sourceMap: opts.sourceMap,
    uglifyOptions: { // UglifyJS config for every workers
      ...opts, 
      ecma: 5
    }
  })

  this.config.plugins.push(plugin)
  return this
}

So then I built several times

$ next build
> Using external babel configuration
> Location: "/mnt/d/Seafile/power-next/.babelrc"
> Using "webpack" config function defined in next.config.js.
Done in 23.60s.

$ next build
> Using external babel configuration
> Location: "/mnt/d/Seafile/power-next/.babelrc"
> Using "webpack" config function defined in next.config.js.
Done in 24.89s.

$ next build
> Using external babel configuration
> Location: "/mnt/d/Seafile/power-next/.babelrc"
> Using "webpack" config function defined in next.config.js.
Done in 21.28s.

~22s, this is pretty slow...
I can validate uglify-es is working by checking the output(which is originally ES6+)

So I decided to turn off parallelization:

addUglifyEsPlugin (opts) {
  const plugin = new UglifyJSPlugin({
    parallel: false,
    sourceMap: opts.sourceMap,
    uglifyOptions: { // UglifyJS config for every workers
      ...opts, 
      ecma: 5
    }
  })

  this.config.plugins.push(plugin)
  return this
}

Shockingly the build time is almost the same with parallel option off!

$ next build
> Using external babel configuration
> Location: "/mnt/d/Seafile/power-next/.babelrc"
> Using "webpack" config function defined in next.config.js.
Done in 22.37s.

$ next build
> Using external babel configuration
> Location: "/mnt/d/Seafile/power-next/.babelrc"
> Using "webpack" config function defined in next.config.js.
Done in 22.63s.

$ next build
> Using external babel configuration
> Location: "/mnt/d/Seafile/power-next/.babelrc"
> Using "webpack" config function defined in next.config.js.
Done in 23.42s.

What. The. Hell. I never realized there's no parallelization!
But even without parallelization there the cache mechanism should have left in effect. I turned back on the parallel option.
Strangely the cache folder is created:

steve@~/power-next$ cd node_modules/.cache/
steve@~/power-next/node_modules/.cache$ ls
babel-loader  uglifyjs-webpack-plugin
steve@~/power-next/node_modules/.cache$

But it doesn't turn the game up whatsoever...Even after post-cache-build...

Interesting, but what in the world just happened?

I have a beast 16-cores Xeon E5 high performance workstation and it definitely kills parallel jobs!

steve@~/power-next/node_modules/.cache$ cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 45
model name      :        Intel(R) Xeon(R) CPU E5-2660 0 @ 2.20GHz
stepping        : 7
microcode       : 0xffffffff
cpu MHz         : 2201.000
cache size      : 256 KB
physical id     : 0
siblings        : 16
core id         : 0
cpu cores       : 8
apicid          : 0
initial apicid  : 0
fpu             : yes
fpu_exception   : yes
cpuid level     : 6
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm pni pclmulqdq dtes64 monitor ds_cpl vmx s
mx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave osxsave avx
bogomips        : 4402.00
clflush size    : 64
cache_alignment : 64
address sizes   : 36 bits physical, 48 bits virtual
power management:

processor       : 15
vendor_id       : GenuineIntel
cpu family      : 6
model           : 45
model name      :        Intel(R) Xeon(R) CPU E5-2660 0 @ 2.20GHz
stepping        : 7
microcode       : 0xffffffff
cpu MHz         : 2201.000
cache size      : 256 KB
physical id     : 0
siblings        : 16
core id         : 0
cpu cores       : 8
apicid          : 0
initial apicid  : 0
fpu             : yes
fpu_exception   : yes
cpuid level     : 6
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm pni pclmulqdq dtes64 monitor ds_cpl vmx s
mx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave osxsave avx
bogomips        : 4402.00
clflush size    : 64
cache_alignment : 64
address sizes   : 36 bits physical, 48 bits virtual
power management:

And I don't think I have wrongfully configured UglifyJSPlugin...

I ran fine with webpack-parallel-uglify-plugin and it really speeds up by a factor of 3_(~22s -> ~8s, close to raw compilation time without any minification)_...Not in this case though.

You may say why shouldn't I adapt to the webpack-parallel-uglify-plugin I used to but because I'm preparing for the future.

I can simply switch back, but it definitely kills my intent...

WELL ANYWAY PLZ FIX

I'm sorry if my wordings are kinda ambiguous, but English is not my mother tongue, heh

Follow the docs but still can't support es6 minify

Hello, Ubuntu server 14.04. As you can see from the log. My js code is valid as es6, but raise Unexpected character '`' error when minified.

webpack.config.js code

var UglifyJsPlugin = require("uglifyjs-webpack-plugin")
...
    new UglifyJsPlugin({
      sourceMap: false,
      compress: {
        warnings: false
      }
    }),
...

log

root@iZj6c0yo64w6enlu2ye50lZ:~/xiangnanscu.github.com# npm install -D git://github.com/mishoo/UglifyJS2#harmony-v2.8.22 --dev
npm WARN install Usage of the `--dev` option is deprecated. Use `--only=dev` instead.
[email protected] /root/xiangnanscu.github.com
├─┬ [email protected]
│ └─┬ [email protected]
│   └── [email protected] 
└─┬ [email protected]  (git://github.com/mishoo/UglifyJS2.git#278577f3cb75e72320564805ee91be63e5f9c806)
  └── [email protected] 

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN [email protected] No repository field.
npm WARN [email protected] No license field.
root@iZj6c0yo64w6enlu2ye50lZ:~/xiangnanscu.github.com# npm install uglifyjs-webpack-plugin --save-dev

> [email protected] postinstall /root/xiangnanscu.github.com/node_modules/uglifyjs-webpack-plugin
> node lib/post_install.js

[email protected] /root/xiangnanscu.github.com
└─┬ [email protected] 
  └─┬ [email protected] 
    └── [email protected] 

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN [email protected] No repository field.
npm WARN [email protected] No license field.
root@iZj6c0yo64w6enlu2ye50lZ:~/xiangnanscu.github.com# npm run b

> [email protected] b /root/xiangnanscu.github.com
> env-cmd ../ngx/config/env-prod.ini cross-env OSS=true webpack --progress --hide-modules

build app.js
 95% emitting/root/xiangnanscu.github.com/dist/blog.app.b2decbfb2e31d95c4dcb.js uploaded to blog.app.b2decbfb2e31d95c4dcb.js
Hash: 2f8eee1a9b2d7f94d928
Version: webpack 2.6.1
Time: 1998ms
                           Asset       Size  Chunks             Chunk Names
blog.app.b2decbfb2e31d95c4dcb.js    16.5 kB       0  [emitted]  main
                   ../index.html  790 bytes          [emitted]  

ERROR in blog.app.b2decbfb2e31d95c4dcb.js from UglifyJs
Unexpected character '`' [blog.app.b2decbfb2e31d95c4dcb.js:168,13]

npm ERR! Linux 4.4.0-79-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "b"
npm ERR! node v6.11.0
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] b: `env-cmd ../ngx/config/env-prod.ini cross-env OSS=true webpack --progress --hide-modules`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the [email protected] b script 'env-cmd ../ngx/config/env-prod.ini cross-env OSS=true webpack --progress --hide-modules'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the pack package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     env-cmd ../ngx/config/env-prod.ini cross-env OSS=true webpack --progress --hide-modules
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs pack
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls pack
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /root/xiangnanscu.github.com/npm-debug.log

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.