Add support for ember-cli addon proxy (bundle caching) #941
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.
As of [email protected], addon instances may be proxied (see ember-cli/ember-cli#9487). This can become a problem when patching (setting/restoring) methods on the addon instance or comparing with the addon
__proto__
.There was an initial workaround for setting/restoring the
preprocessJs
method (see ember-cli/ember-cli#9562). This has proven to be unsustainable as other similar issues were uncovered.For example, when an addon is proxied, this comparison will always be
true
:... as the methods on the
__proto__
are the original method, while on the (proxied) addon are proxy methods. This particular scenario manifests in empty addon trees for proxied addons.The fix here is to get a reference to the real addon whenever patching methods or comparing to the
__proto__
.A similar solution was implemented in
ember-engines
(see ember-engines/ember-engines#769).