-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
CRA_BABEL_PRESET_FILE to handle optional dependencies. #2775
CRA_BABEL_PRESET_FILE to handle optional dependencies. #2775
Conversation
This looks promising. |
dfbe775
to
c143cb3
Compare
* This will allow for optional babel dependencies to be added without ejecting cra. * CRA_BABEL_PRESET_FILE=relative/path/to/babel/preset can be added to package.json.
c143cb3
to
f7bba1d
Compare
Thanks! I also updated the documentation for Advanced Configuration. |
Unfortunately, I do not see this as a suitable solution -- this is effectively letting someone gain full control over the babel preset and allows them to break certain things or use a I appreciate your work, however, @jsdevel. |
Right now, I would love some feedback on #2784 -- a Relay plugin would be great! |
@Timer thanks for the feedback. I spent time mulling over #2784 before introducing this as an alternative. Really my main reason for introducing this hinged around @gaearon 's comment #2343 (comment) which stated:
When I saw that I realized that we probably just need a simply way of extending CRA for those who would rather not eject, but are comfortable maintaining certain parts. |
Managing certain parts of the configuration falls outside of our core philosophy, even if the user(s) are comfortable with doing so. It breaks what people love about updating For example, when we upgrade to Babel 7, many users will experience breakages if they use a custom babel preset. They may rely on presets which were not updated to have Babel 7 support. Or they may find themselves using a stage preset which will change wildly in the next Babel release. Since there's no merging of the babel preset either, many people will lag behind when we upgrade our Babel preset like we have recently, e.g.:
We may be adding other plugins in the future:
If people are comfortable taking full control over the Babel Configuration, they may as well eject so things don't break unexpectedly for them. |
To me this is one of those cases. Most users aren't likely to regularly update react-scripts, ejected or not. If they do then they understand that certain things might break and need refactoring afterwards. |
Isn't that the cost of updating any framework? |
Either way, I thought this proposal was easy enough to put together to warrant the conversation. I'll be perfectly happy if it gets merged or abandoned. CRA is worth it 😂 |
Really? As far as I know people update
Not our framework. 😛 We aim to be as painless as possible; providing explicit migration instructions for any possible breakages (which only happen in seldom major version releases). |
Closing per our discussion; sorry! We're just not ready to allow this sort of configuration yet. Check out Neutrino or react-app-rewired! |
I verified this locally by copying
index.js
tonode_modules/babel-preset-react-app/index.js
within one of my projects. Here is the package.json for my project:I'm doing this because I want to use relay modern in my app. My
.babel-preset-react-app.js
file is exactly what @maletor had in PR #2343cc @gaearon Is this an acceptable approach per your comment #2343 (comment) ?
Also relates to #2001