-
-
Notifications
You must be signed in to change notification settings - Fork 5k
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
feat(webpack): extendable functional babel.presets and babel envName #5637
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #5637 +/- ##
=========================================
- Coverage 95.7% 95.67% -0.04%
=========================================
Files 81 81
Lines 2633 2634 +1
Branches 670 671 +1
=========================================
Hits 2520 2520
- Misses 95 96 +1
Partials 18 18
Continue to review full report at Codecov.
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
A note that could be probably useful for documentation. It is also supported that user directly modify second argument of |
@pi0 You’re right, bro, it’s already in the code of pr message, maybe not well organized,I’ll refine it and also create doc or |
Nice work on this PR @clarkdo It keeps simplicity while giving advanced configuration for experts. It could be nice to add a PR to update https://nuxtjs.org/api/configuration-build#babel |
Sorry that I missed the conversation here: What's the current stand regarding applying a .babelrc or babel.config.js? Isn't Nuxt ignoring them by default right now? |
@manniL The Although we support |
@clarkdo Ah, got it! Thanks |
Hide Comment
What's current situation
Current babel config in Nuxt.js is kind of complex and limited:
build.babel.presets
supportsFunction
,Array
which may be confusing@nuxt/babel-preset-app
needs more useless code (via functional babel.presets)What's in this pr
This pr suggests using
babel.config.js
inrootDir
which aligns tobabel default behaviour
, user can easily config babel like:For more complex scenario, it's also easier which is not possible in current Nuxt.js:
What's next (Nuxt.js v3)
I suggest that we remove
build.babel
and use native babel config way, actuallybabel-loader
has already been usingbabel options
as options of loader instead of self-defined options.The current default preset config can be kept as default value when no babel config file found.
After discussion with @pi0 , we think keeping good DX and avoiding conflicts are very important.
So I have changed the pr:
build.extend
for functionalpresets
:configFile
configFile
is not suggested to be used only if you know what you're doing