-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
[WIP] presets - merge default babel configs #4107
[WIP] presets - merge default babel configs #4107
Conversation
…o core/presets-merge-babel-configs
…o core/presets-merge-babel-configs # Conflicts: # lib/core/package.json # lib/core/src/server/core-preset-dev.js # lib/core/src/server/core-preset-prod.js # yarn.lock
Generated by 🚫 dangerJS |
Codecov Report
@@ Coverage Diff @@
## core/framework-core-presets #4107 +/- ##
===============================================================
- Coverage 40.74% 40.49% -0.26%
===============================================================
Files 491 491
Lines 5794 5830 +36
Branches 779 793 +14
===============================================================
Hits 2361 2361
- Misses 3058 3080 +22
- Partials 375 389 +14
Continue to review full report at Codecov.
|
const { configDir, wrapDefaultBabelConfig = noopWrapper } = options; | ||
|
||
const babelOptions = presets.extendBabel({}, { configDir, wrapDefaultBabelConfig }); | ||
const babelOptions = presets.extendBabel({}, options); |
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 breaks Babel 6 support, because it adds our defaults (which are Babel 7 only) to all configs
Error: Requires Babel "^7.0.0-0", but was loaded with "6.26.3". If you are sure you have a compatible version of @babel/core, it is likely that something in your build process is loading the wrong version. Inspect the stack trace of this error to look for the first entry that doesn't mention "@babel/core" or "babel-core" to see what is calling Babel. (While processing preset: "/mnt/agent/work/a1796458d49a7849/node_modules/@babel/preset-react/lib/index.js")
[00:16:35][Step 2/2] at throwVersionError (/mnt/agent/work/a1796458d49a7849/node_modules/@babel/helper-plugin-utils/lib/index.js:65:11)
[00:16:35][Step 2/2] at Object.assertVersion (/mnt/agent/work/a1796458d49a7849/node_modules/@babel/helper-plugin-utils/lib/index.js:13:11)
[00:16:35][Step 2/2] at _default (/mnt/agent/work/a1796458d49a7849/node_modules/@babel/preset-react/lib/index.js:61:7)
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.
We really need separate extendDefaultBabel
and extendBabel
. The former should only be applied to our defaults (which aren't applied for Babel 6), and the latter to final config
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.
Actually, react-docgen is probably the only usecase for the latter
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.
You mean react-docgen
is the only working usecase?
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.
It's the only plugin that we need to add to any configuration (using wrapBabelConfig
) because it typically isn't used in user app. All the other stuff should only be added to default babel config.
Maybe we could add react-docgen
in app/react
's extendWebpack
to avoid two different babel extenders
Issue: This PR is based on the #4043 (for the reviewability)
What I did
I've removed
wrapDefaultBabelConfig
in apps, and added the ability to merge babel configs. This will ease the app creation process and presets usage