Closed galvez closed 3 years ago
I makes sense to allow the usage of Webpack chain, I think using extendChain
makes more sense actually to avoid breaking change or changing any methods signature.
Cool, I'll start working on a PR for further review -- should be pretty straightforward to implement.
webpack-chain does support converting webpack config
object to chain object
as https://github.com/neutrinojs/webpack-chain/issues/90 , so it may be more complex for Nuxt to migrate to webpack-chain.
@clarkdo yeah, I think I may have found a way thought. Will demonstrate in PR.
Using extend
providers much more customization surface and i think is not a good practice to encourage users directly modify webpack config for each loader integration but using nuxt modules that extend config. Adding chain to core, either needs a breaking change to migrate to webpack chain or 2 extend functionalities and maintaining/supporting them.
PS: Your demo is not fair :D I'm not sure vue-cli snippet works as is for nuxt config.
PSS: If there is a workaround, we can first try with a nuxt module that adds chain support.
Another point is that webpack-chain
needs time for supporting latest webpack.
For example, we already proposed pr for webpack 5 which may need time for webpack-chain to implement.
@pi0 yep, makes sense. I can demonstrate my approach with a module too :)
Module sounds like a great approach actually :)
Any news on this? :)
Clarification: Nuxt3 rewrite for webpack config, is via preset/functions. So finally using a module to convert config into wp chain and back to object is preferred. We might add such utility to nuxt/kit...
In rewriting vue-element-admin to Nuxt, I came across this disparity:
Vue-CLI version:
Nuxt version:
I propose we either:
1) Pass a webpack-chain instance as config in
extend()
(breaking change)or, to preserve backwards compatibility:
2) Introduce a second
extend()
parameter calledchain
, example:or
3) Introduce an
extendChain()
parameter: