webpack-configurator icon indicating copy to clipboard operation
webpack-configurator copied to clipboard

Mixin _.set

Open vjpr opened this issue 9 years ago • 2 comments

it would be cool to be able to write:

config.set('entry.main', './foo.js')

_.set provides this.

Why?

I find that big nested objects are common in webpack configs but are hard to keep track of the nesting level. This would allow a nice un-nested webpack config.

vjpr avatar Oct 27 '15 22:10 vjpr

Or rather, allow an override of config.merge('entry.main', ['./foo.js']). If first arg is string, generate an object of the string path, then merge.

Set would be useful separately to override things.

vjpr avatar Oct 27 '15 22:10 vjpr

I do quite like this idea. I agree that heavily nested configurations aren't nice to deal with. Maybe this kind of thing will help reduce that pain.

My approach in the past has been to split out sections into variables (and sometimes methods) to reduce the immediate nesting.

lewie9021 avatar Oct 27 '15 23:10 lewie9021