webpack-chain
webpack-chain copied to clipboard
Create from existing webpack config object
I would love to be able to construct a webpack chain instance from an existing webpack config object. I've searched the documentation and code and it doesn't seem to be possible as far as I can tell. My main use cases are to take a shared webpack config object and modify it. The shared webpack config object is published to npm as module.exports = {...}
, not as a webpack chain instance.
If you're open to this, I am interested in exploring what an implementation would look like for this, and even put together a PR for it.
I have the same needs.
This could also be a great way to allow for cloning webpack-chain config, since according to another issue is not yet possible.
Bump
One of the issues here, is that the webpack-chain's representation of a webpack-config is richer than the original webpack-config. That is, there is additional metadata that names parts of the config, allowing for them to be referenced/manipulated more easily.
As such, if one tried to implement this, you'd have to pick random names/identifiers for the parts of the config that weren't set via webpack-chain (eg ascending numbers or something), making it hard to manipulate them without having to hardcode numerical indices, thereby defeating much of the purpose of webpack-chain.
At which point, why even try and use webpack-chain, and why not just manipulate the original webpack-config directly?