Since JavaScript does not have well-defined scope rules, it is not possible to exclude names in a way that is guaranteed to be correct.
For example, if you had the following function:
function f() { return { first: 'foo', second: 'bar' }; }
To trick property names, you will need to nail all the places f is called from. Because functions are first-class in JavaScript, they can be assigned and passed in arbitrarily, making binding impossible where f referenced without actually running the program.
In addition, JavaScript does not have the ability for you to specify what a public API is and what is not. Even if the minimizer can reliably determine where the function is being called from the code that you give it, there would be no way to make the same changes in the code that it did not see.
Bryan kyle
source share