This repository has been archived by the owner on Dec 30, 2022. It is now read-only.
chore(babel): migration to Babel 7 [PART-1] #1888
Merged
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.
Summary
This PR moves packages, Storybook, docgen to Babel 7. Only the examples are still built with Babel 6 but they are outside of the workspaces. We can update them later. The major change is that we now use the project-wide configuration
babel.config.js
rather than scoped.babelrc
. We only have one point of contact for the all projects. We can write overrides per files / folders to apply a specific set of plugins to the matches (like we do formaps
package).The downside of this approach is that since we called
babel
from a nested level we have to provide a flag to tell Babel to find the proper configuration. Previously it was automatic, but not anymore. There is mode to callupward
to walks and find the correct configuration. Note that we are gonna hoist all the build step at the top of the package so this mode won't be used anymore at some point (at least for thepackages
).Last downside of this change is the bundle size, since Babel 7 is closer to the spec it generates more helpers to actually check if the code is valid or not. There is a
loose
mode to avoid this but we can get rid of this increase with@babel/runtime
. It's implemented in the next PR.