Fix issues when using colocated component's with decorators. #340
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.
The changes made in f9053bc added the ability to detect
export { Foo as default }
along side the ability to detectexport default Foo
. When ran in isolation (or with the@babel/plugin-transform-typescript
) this works fine, but in common scenarios without typescript support it failed.The cause of the failure is a bit difficult to grok, but basically it is because when our
ExportDefaultDeclaration
hook is hit, we add thesetComponentTemplate
invocation. Then subsequently another plugin changes fromexport default Foo
toexport { Foo as default }
(the combination of@babel/plugin-proposal-decorators
and@babel/plugin-proposal-class-fields
does this), and we run the newExportNamedDeclaration
which causes us to addsetComponentTemplate
invocation again.The fix added here ensures that only one
setComponentTemplate
invocation will be added (even if we see bothexport default Foo
andexport { Foo as default }
during traversal).Fixes #339.