Skip to content

Instantly share code, notes, and snippets.

@jennings
Created June 13, 2018 18:19
Show Gist options
  • Save jennings/3214ab40ea609cef026a1d1082dbe64b to your computer and use it in GitHub Desktop.
Save jennings/3214ab40ea609cef026a1d1082dbe64b to your computer and use it in GitHub Desktop.
UglifyJS reproduction
function fn1() {
return function fn2(ARG1) {
return callApi({ foo: ARG1 })
.then(handler);
function handler(response) {
const obj = { PROP: response };
return (inlinedFunction(obj.PROP))
.then(fn3());
}
function fn3() {
return WRONG_VARIABLE_AFTER_MINIFICATION(ARG1)
}
}
function inlinedFunction(ARG1) {
return callApi(ARG1)
}
}
function fn1() {
return function(ARG1) {
return callApi({ foo: ARG1 }).then(function(response) {
return ((ARG1 = response), callApi(ARG1)).then(
WRONG_VARIABLE_AFTER_MINIFICATION(ARG1)
);
var ARG1;
});
};
}
{
"name": "uglify-repro",
"version": "1.0.0",
"main": "index.js",
"author": "Stephen Jennings",
"license": "MIT",
"scripts": {
"build": "uglifyjs input.js -o output.js --compress && prettier --write output.js"
},
"dependencies": {
"prettier": "^1.13.5",
"uglify-es": "^3.3.9"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment