feat: export default config#19005
Conversation
fb7633f to
148cc28
Compare
148cc28 to
56b69bc
Compare
|
I have no idea what's wrong with the CJS build, I don't see where side effects are being introduced that pkg is required... 😅 |
|
Recently we considered exposing the default config values, but didn't do it, because we were not sure how to expose them in a intuitive way. |
|
@sapphi-red (if you want me to continue the discussion in the original place, please let me know) Also, as an FYI, after diving into Vite's source code, I wanted (for another PR) to change the way the defaults are accessed: I believe they should be factory functions instead, so we always get copies of them and utils like deepClone will not be needed. |
What should be set for these options? |
|
@sapphi-red Oh I see what you mean now, thanks! Wouldn't a function returning an object, like I suggested in my previous comment, solve exactly this? It could have a |
Maybe it would work if the parameter doesn't get huge. I haven't looked if |
|
I'm going to close this for now as there's still questions about how the configs should be exposed, especially conditional ones. If this is still needed, it'd be best to open a new issue to discuss it. |
Description
Makes the default config consumable by the user.
Use case
I'm developing a plugin that needs to access the
build.outDirvariable:However,
conf.build.outDirvariable is only defined if the user has provided that option in their own configuration file. If not, it will only be accessible on theconfigResolvedhook, which makes our use case useless.With this PR, we can make a graceful fallback: