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
(as suggested by @sebmarkbage)
The minifier already has simple constant folding and/or dead-code elimination of primitives:
if (__DEV__) { }
It would be great if it could also do that for frozen objects and non-writable/non-configurable properties.
If I declare an object like:
var obj = {}; Object.defineProperty(obj, 'foo', { configurable: false, writable: false, value: false });
Then this expression should also evaluate to false and be dead-code eliminated:
if (obj.foo) { }
If the primitive value is a number or boolean it would rewrite it:
var x = obj.foo;
could be rewritten to:
var x = 123;
However, the most important one for potential further optimization would be rewriting bindings for non-primitives;
A binding like:
obj.foo();
would be rewritten to:
foo();
and the minifier would somehow communicate back that the obj binding is now replaced with the foo binding which should have the value of obj.foo.
obj.foo
The text was updated successfully, but these errors were encountered:
No branches or pull requests
(as suggested by @sebmarkbage)
The minifier already has simple constant folding and/or dead-code elimination of primitives:
It would be great if it could also do that for frozen objects and non-writable/non-configurable properties.
If I declare an object like:
Then this expression should also evaluate to false and be dead-code eliminated:
If the primitive value is a number or boolean it would rewrite it:
could be rewritten to:
However, the most important one for potential further optimization would be rewriting bindings for non-primitives;
A binding like:
would be rewritten to:
and the minifier would somehow communicate back that the obj binding is now replaced with the foo binding which should have the value of
obj.foo
.The text was updated successfully, but these errors were encountered: