refactor(webpack): add ability to get webpack config class#5378
refactor(webpack): add ability to get webpack config class#5378
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #5378 +/- ##
==========================================
- Coverage 96.01% 95.97% -0.04%
==========================================
Files 74 74
Lines 2532 2535 +3
Branches 641 640 -1
==========================================
+ Hits 2431 2433 +2
- Misses 85 86 +1
Partials 16 16
Continue to review full report at Codecov.
|
|
@visualfanatic Please ensure the test suite passes first. |
| } | ||
| } | ||
|
|
||
| getWebpackConfig(name) { |
There was a problem hiding this comment.
How about returning config object here, then we don't need an extract bind.
Otherwise, if we call config separately, we can leverage Promise.all to enhance config() performance.
There was a problem hiding this comment.
@pi0 your change was a surprise, but it was appreciated, thank you.
|
Changed title to |
|
As I proposed here, I think it could be useful for some advanced modules to be able to extend the webpack base config class for independent webpack build based on Nuxt base config. It's just about exposing WebpackBaseConfig (and possibly export { WebpackBundler as BundleBuilder } from './builder'
export { default as WebpackBaseConfig } from './config/base' |
|
There is no guarantee about structure of webpack config classes to be the same across releases. So one can use final result and use/extend it for advanced use cases. |
Types of changes
Description
This PR is an improvement of #5366 and adds a new method to
WebpackBundlerthat returns a webpack config class (WebpackClientConfig,WebpackServerConfigorWebpackModernConfig).I also cleaned up the
buildmethod a bit and moved the plugin aliases intoWebpackClientConfigandWebpackServerConfigso that each class has all of it's webpack aliases in one place.Checklist: