-
-
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
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. |
@@ -37,44 +37,32 @@ export class WebpackBundler { | |||
} | |||
} | |||
|
|||
getWebpackConfig(name) { |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
@clarkdo Refactor applied. Please review again.
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.
@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
WebpackBundler
that returns a webpack config class (WebpackClientConfig
,WebpackServerConfig
orWebpackModernConfig
).I also cleaned up the
build
method a bit and moved the plugin aliases intoWebpackClientConfig
andWebpackServerConfig
so that each class has all of it's webpack aliases in one place.Checklist: