-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Config Function #3077
Comments
Today for something like hostHeader, you can do something like: const config = {
kit: {
target: "#svelte",
hostHeader: process.env.NODE_ENV !== "development" ? "x-forwarded-host" : "",
}
}
export default config; And by checking the const config = yourCustomFunction(process.env.NODE_ENV)
export default config; |
fyi: this RFC sveltejs/rfcs#59 describes a solution for svelte config with builtin function support. |
Given that top-level await is a thing, do we need function support? |
Perhaps a function would make more sense if we implement #1258 |
@Rich-Harris valid question. I think the consistency across APIs would make it more usable, but I'm easily persuaded here. I think I'm just too old - forgot top level await was allowed. |
Going to close this for the sake of tracker hygiene unless another use case presents itself |
Describe the problem
Much like vite, some configuration options for svelte kit are dependent on the mode you're running in. In particular the
hostHeader
which is rarely wanted when you're running locally (some docker-configs excepted). Currently we have to rely on environment variables which are OK, but less smooth a path than vite's strategy of accepting either a function or a config object.Describe the proposed solution
I'd love for svelte to accept either a config object, or a function that receives some environment information and returns the config object. I brainlessly spent about an hour this morning confusing the Vite and svelte configurations and assuming I could use a function for both. The hour wasted was my fault, but it did reveal a feature that would be simple and nice.
Alternatives considered
Environment variables.
Importance
would make my life easier
Additional Information
No response
The text was updated successfully, but these errors were encountered: