We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug
Minification produces output where a variable is only minified sometimes within a function. Thanks for your help!
To Reproduce
Minimal code to reproduce the bug
function foo() { let varName = []; while (false) {} varName; }
Actual Output
"use strict"; function foo(){ for(var a=[];false;); varName }
Expected Output
I'm not sure if it's expected to pull the varName variable into the loop in this circumstance, so the expected output is one of the following:
varName
"use strict"; function foo(){ for(var a=[];false;); a }
or
"use strict"; function foo(){ var a=[]; for(;false;); a }
Configuration
Turning off all minify plugins except for mangle and simplify (bug requires both).
mangle
simplify
npx babel ./src --out-dir ./lib
babel-minify version: 0.5.1
0.5.1
babel core : 7.11.6
7.11.6
babel-minify-config:
{ "mangle": true, "simplify": true, "evaluate": false, "replace": false, "booleans": false, "builtIns": false, "consecutiveAdds": false, "deadcode": false, "flipComparisons": false, "guards": false, "infinity": false, "memberExpressions": false, "mergeVars": false, "numericLiterals": false, "propertyLiterals": false, "regexpConstructors": false, "removeConsole": false, "removeDebugger": false, "removeUndefined": false, "simplifyComparisons": false, "typeConstructors": false, "undefinedToVoid": false }
babelrc:
module.exports = { presets: [ '@babel/preset-env', ['minify', { "mangle": true, "simplify": true, "evaluate": false, "replace": false, "booleans": false, "builtIns": false, "consecutiveAdds": false, "deadcode": false, "flipComparisons": false, "guards": false, "infinity": false, "memberExpressions": false, "mergeVars": false, "numericLiterals": false, "propertyLiterals": false, "regexpConstructors": false, "removeConsole": false, "removeDebugger": false, "removeUndefined": false, "simplifyComparisons": false, "typeConstructors": false, "undefinedToVoid": false }] ], plugins: [ ], }
Possible solution
Not sure. But it appears the logic in this region may need to be improved, when it decides if a variable is referenced outside the loop.
The text was updated successfully, but these errors were encountered:
I just ran into this one too. Here's my reproduction (but it's very similar): https://babeljs.io/repl#?browsers=&build=&builtIns=false&corejs=3.6&spec=false&loose=false&code_lz=EQVwzgpgBGAuBOBLAxrYBuAUJgZiAdqogPb5SwRwCqYi-A5gDISwCMAFAJRQDemUUADYsoANwCG8AHLiAttAC8UAAxYBAdwAWiYVHYTpc6AB4orbgGoLBmfLVQA9A6gBlTcRCCAJlHzFYUODQBLLiDMI-NkYAdPxQyKRgxMLRgsT0-pK2JmacWAC-2HiEsCRkFNS0DMywAExcvHHCAVF2cTjE8HqtiiroYllGUKas_VY9eXEJ-EkpaRk9w7kFRQREpOSUsDR09ABqkg18AgYDhvJQSqpxWjrQmec55lDjg20C07MQqekP2UvmApAA&debug=false&forceAllTransforms=false&shippedProposals=false&circleciRepo=&evaluate=true&fileSize=false&timeTravel=false&sourceType=script&lineWrap=true&presets=env&prettier=false&targets=&version=7.15.6&externalPlugins=babel-plugin-minify-mangle-names%400.5.0%2Cbabel-plugin-minify-simplify%400.5.1&assumptions=%7B%7D
Sorry, something went wrong.
this
No branches or pull requests
Describe the bug
Minification produces output where a variable is only minified sometimes within a function. Thanks for your help!
To Reproduce
Minimal code to reproduce the bug
Actual Output
Expected Output
I'm not sure if it's expected to pull the
varName
variable into the loop in this circumstance, so the expected output is one of the following:or
Configuration
Turning off all minify plugins except for
mangle
andsimplify
(bug requires both).babel-minify version:
0.5.1
babel core :
7.11.6
babel-minify-config:
babelrc:
Possible solution
Not sure. But it appears the logic in this region may need to be improved, when it decides if a variable is referenced outside the loop.
The text was updated successfully, but these errors were encountered: