Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi, this adds a small DX/QOL improvement:
mix.when()
. Mix has a wonderful, fluent API, and it often feels a little janky to me to break out of that when needing to do some conditional configuration. I hope that this helper will reduce that a little bit. This is of course inspired by Laravel's various->when($condition, $callback)
helpers.I added
mix.when()
to the stockwebpack.config.js
, but I wasn't sure if/where to add it to docs. If you could suggest the right place to add some docs, I'd be happy to do so. Oh, and this also includes a very minor docblock fix inApi.js
.Example
From one of my own
webpack.config.js
:Which this PR, this could be rewritten as:
Thanks!