Hi there,
incredible work on the cli & tooling configuration. However, even the greatest config does not meet all needs and thus the question - Do you have plans on allowing users to extend default configuration?
Some use cases as a conversation starting point:
import Header from '../../../../components/Header) - normally this would be done via babel plugin or webpack alias,AFAIK create-react-app have chosen not to allow changing configuration. However they provide eject functionality which generates all config files (docs).
The only problem with this is that once ejected there's no easy way with keeping ejected config in sync with create-react-app.
I also think it would be a good feature, this would give much more flexibility to the project.
I would like to allow configuration extension by looking for a preact.config.js, which can export a function that mutates the generated webpack configuration however it pleases.
For plugin ordering we might need to do something like proxy plugin instantiation and annotate each plugin instance with a human-readable name so that they can be change later.
Do you need help with that? I'll be happy to provide a PR.
Maybe preact.config.js could be written in ES6 and name property would be enough? As in:
config.plugins.map(p =>p.name)
/* ['CommonChunksPlugin', 'ExtractTextPlugin', 'ProvidePlugin'] */
Hopefuly it will :smile:
^ hopefully. That or we provide a helper to get the name from any plugin in the plugins array based on the constructor name.
Writing it in ES6 is fine, I think preact-cli already includes babel-register in order to do prerendering. I left a comment here with more thoughts on the idea: https://github.com/developit/preact-cli/issues/37#issuecomment-303383725
I would love to have this ability as well. I want to customize postcss plugins so I can do this: https://github.com/react-toolbox/react-toolbox#settings-configuration-variables-in-javascript
Custom configuration support has landed in 1.3.0.
Most helpful comment
Custom configuration support has landed in
1.3.0.