Repository navigation
Fully support Closure compiler including ADVANCED_OPTIMIZATIONS - #307
Merged
Merged
Conversation
Currently, compiling lit-element with the Closure compiler results in a clean build but a number of hard JS errors due to a few issues: - static methods being collapsed (i.e. removed entirely) - Object.hasOwnPropertyName() looking for static properties that have been rewritten by the compiler - static property initializers not being run when @exported The last issue is a compiler bug being tracked internally, but all three need to be worked around before this will compile and run cleanly. This includes all of the necessary fixes, including addressing the last issue by moving the Object.hasOwnPropertyName('_classProperties') check to _finalize(). This is necessary to ensure that _classProperties is defined before it's iterated in observedProperties on an element that has no properties. Another option for making _finalized and _classProperties public would be to move to checking this._finalized and this._classProperties and not needing to access them by name - I thought that was out of scope for this but would be happy to change to that style if reviewers prefer.
Contributor
|
The most surprising change is the static property initializers. Apparently static fields don't consistently inherit after optimization in closure compiler |
Member
|
We're going to need to slightly change the way |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, compiling lit-element with the Closure compiler results in a
clean build but a number of hard JS errors due to a few issues:
been rewritten by the compiler
The last issue is a compiler bug being tracked internally, but all three
need to be worked around before this will compile and run cleanly.
This includes all of the necessary fixes, including addressing the last
issue by moving the Object.hasOwnPropertyName('_classProperties') check
to _finalize(). This is necessary to ensure that _classProperties is
defined before it's iterated in observedProperties on an element that
has no properties.
Another option for making _finalized and _classProperties public would
be to move to checking this._finalized and this._classProperties and not
needing to access them by name - I thought that was out of scope for
this but would be happy to change to that style if reviewers prefer.