A dependency package imports JSON in its code. Destructuring assignment is used to get values from the parsed JSON. Minification generates incorrect output by inconsistently mangling names from JSON.
Why do I feel this is the issue of the plugin instead of terser itself?
I used terser directly, i.e. npx terser ..., to minify code, including the individual files and/or the unminified bundle. The output was correct.
Plugins for other tool chains like gulp also generates correct output.
Actual Behavior
Minification mangles names from JSON and destructuring assignment inconsistently. Plugin options, including terserOptions, include/exclude, cannot stop name mangling in JSON.
Expected Behavior
Minification mangles names from JSON and destructuring assignment consistently. Plugin options can control name mangling in JSON.
Bug report
A dependency package imports JSON in its code. Destructuring assignment is used to get values from the parsed JSON. Minification generates incorrect output by inconsistently mangling names from JSON.
Why do I feel this is the issue of the plugin instead of terser itself?
I used terser directly, i.e.
npx terser ...
, to minify code, including the individual files and/or the unminified bundle. The output was correct.Plugins for other tool chains like
gulp
also generates correct output.Actual Behavior
Minification mangles names from JSON and destructuring assignment inconsistently. Plugin options, including
terserOptions
,include
/exclude
, cannot stop name mangling in JSON.Expected Behavior
Minification mangles names from JSON and destructuring assignment consistently. Plugin options can control name mangling in JSON.
How Do We Reproduce?
This is my reproduction repository https://github.com/edmonl/demo-webpack-terser-issue . See
README.md
.Please paste the results of
npx webpack-cli info
here, and mention other relevant information