-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: export default config #19005
base: main
Are you sure you want to change the base?
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 |
Description
Makes the default config consumable by the user.
Use case
I'm developing a plugin that needs to access the
build.outDir
variable:However,
conf.build.outDir
variable is only defined if the user has provided that option in their own configuration file. If not, it will only be accessible on theconfigResolved
hook, which makes our use case useless.With this PR, we can make a graceful fallback: