New issue
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
chore(babel-preset-expo): remove babel decorators plugin #27857
Open
Nodonisko
wants to merge
1
commit into
expo:main
Choose a base branch
from
Nodonisko:chore/remove-babel-decorators-plugin
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+40
−2
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a major breaking change to the language feature support in expo. Unclear if we want to approach the change like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree this is breaking change, but it's impossible to change version of decorators if you want to use expo preset.
I can try to explore more possible solutions. One that popped right now to my mind is to use env variables, but it's quite uncommon approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall I am supportive of removing the decorators plugin by default, especially
legacy: true
. Also, decorators in general are a language feature that look simpler than the amount of power they have and until the proposal reaches Stage 4 I am in favor of requiring a little friction to use decorators specifically.However, there needs to be a smooth migration path and clear guidance for developers beyond, "Breaking change:
@babel/plugin-proposal-decorators
is no longer included inbabel-preset-expo
". Some things that could help are to:enableLegacyDecorators
that they can use for one SDK version to opt back in to the old behavior. However, if they can just add back[require('@babel/plugin-proposal-decorators'), { legacy: true }]
to their own Babel configuration, I don't feel a need for a flag.It would also be good to verify that popular libraries don't need this feature. AFAIK the expo repo itself doesn't rely on this feature but if a library like react-navigation does, I would be more hesitant to change things.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add
plugin-proposal-decorators
option to the preset options which can be set tofalse
to disable the plugin (which can be used to add a new plugin) or be used to pass additional options to the plugin.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@EvanBacon I was not aware that preset could have options. It seems like best option. I will rewrite my code to use it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@EvanBacon @ide I reworked PR and added
decoratorsPluginVersion
which could be set to specific version orfalse
and defaults tolegacy
.I am not entirely sure if I like mixing of
string
andboolean
but I noticed similar approach is used forlazyImports
option. Alternatively I can adddisableDecoratorsPlugin
option in addition to version to avoid this.I don't think it's necessary to cover other options because there is only one addition option
decoratorsBeforeExport
but that can be used only withlegacy
so it's basically deprecated.