New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Function names are not properly minified and causes a invalid syntax when ecma=5
is provided
#1019
Comments
Cli version I was able to reproduce this outside webpack, by using Here is the flags to be used in cli to get a chunk that generates the invalid syntax. terser 380.7ed8f3df.js<chunk-name> -o compress.js -c ecma=5 --keep_classnames --keep_fnames PS: The Then load the chunk in browser |
ecma=5
is provided
Ok, I got to the bottom of this. With
Terser will join
Because of |
In the end it was just a matter of adding parens. This was already being done for other expressions, but not arrow functions. |
Bug
Version ^5.7.0
{ keep_fnames: true, keep_classnames: true }
These values are initially passed inside the
terser-webpack-plugin
. https://github.com/JayaKrishnaNamburu/terser-minifier-bug-reproduction/blob/main/webpack/webpack.config.prod.js#L18I am using terser alongside
webpack
viaterser-webpack-plugin
and when built for production. The function is replaced with somefor loop
with a invalid syntaxterser
inputTerser input was from a
npm
module. And the raw file can be found here https://unpkg.com/browse/@teleporthq/teleport-plugin-common@0.17.0/dist/esm/index.jsterser
output or errorI Recorded a small video on the behaviour and it can be found from the initial issue which i raised here webpack-contrib/terser-webpack-plugin#410 in the webpack plugin itself.
Screen.Recording.2021-07-01.at.11.30.01.PM.mov
Git Repository to reproduce the bug
https://github.com/JayaKrishnaNamburu/terser-minifier-bug-reproduction
Steps to reproduce from the Git repository
https://github.com/JayaKrishnaNamburu/terser-minifier-bug-reproduction#readme
The text was updated successfully, but these errors were encountered: