Skip to content
This repository has been archived by the owner on Dec 5, 2019. It is now read-only.

[Bug] nameCache doesn't get applied (uglifyOptions.nameCache) #130

Closed
ghost opened this issue Sep 21, 2017 · 4 comments
Closed

[Bug] nameCache doesn't get applied (uglifyOptions.nameCache) #130

ghost opened this issue Sep 21, 2017 · 4 comments

Comments

@ghost
Copy link

ghost commented Sep 21, 2017

In buildDefaultUglifyOptions every option except sourceMap and nameCache are handled. sourceMap has a comment that it's being ignored, but nameCache is strangely absent. Is there a reason for that, or is it simply an oversight?

@michael-ciniawsky
Copy link
Member

nameCache isn't used by default (null), but you can use it as all uglify options are supported by the plugin.

@ghost
Copy link
Author

ghost commented Oct 10, 2017

No. It's not passed through.

@michael-ciniawsky michael-ciniawsky changed the title nameCache [Bug] nameCache doesn't get applied (uglifyOptions.nameCache) Oct 10, 2017
@michael-ciniawsky michael-ciniawsky added this to the 1.0.0 milestone Oct 10, 2017
@simonjoom
Copy link

simonjoom commented Oct 23, 2017

yes i found the same issue,
here the code to change pass this resolve it 👍
It's a big problem for using multi-chunk with web pack
without this the chunks are not properly compressed because the mangles property deleted between them

in the code minify.js of uglifyjs-webpack-plugin need to pass the property nameCache

var buildDefaultUglifyOptions = function buildDefaultUglifyOptions(_ref) {
  var ecma = _ref.ecma,
      warnings = _ref.warnings,
      _ref$parse = _ref.parse,
      parse = _ref$parse === undefined ? {} : _ref$parse,
      _ref$compress = _ref.compress,
      compress = _ref$compress === undefined ? {} : _ref$compress,
      mangle = _ref.mangle,
      output = _ref.output,
      toplevel = _ref.toplevel,
      ie8 = _ref.ie8,
      nameCache = _ref.nameCache; ///just added

  return {
    ecma,
    warnings,
    parse,
    compress,
    mangle: mangle == null ? true : mangle,
    // Ignoring sourcemap from options
    sourceMap: null,
    output: Object.assign({
      comments: /^\**!|@preserve|@license|@cc_on/,
      beautify: false,
      semicolons: true,
      shebang: true
    }, output),
    toplevel,
    ie8,
    nameCache   ///just added
  };
};

@alexander-akait
Copy link
Member

@simonjoom can you create minimum reproducible test repo?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants