-
-
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
Logging for overridden config in vite does not include cors options for dev and preview #12574
Comments
I suspect fixing this may be as simple as adding the
|
different PR, see below |
That commit appears to be simply moving the I'm not suggesting removing these options, but sveltekit overriding user provided options should be included in the vite warning log, similar to other options that are overridden. I believe |
I am not sure overriding user provided options is the right way here. having cors disabled is something users might want even in dev/preview. The example in #8731 (good find) indicates that explicit false should be. |
as a workaround, you can add a vite plugin with a config hook after the sveltekit plugin to reset it to false:
|
Yeah, I’m highly in favour of letting user config take precedence. I think the only reason I didn’t do so in that PR was because the preflight continue option managed to preserve existing behaviour while allowing the options endpoint to work |
A proposal, re: "letting user config take precedence":
Is this behavior too complicated? It seems to me that it would be the best DX where OPTIONS handlers will 'just work' but vite cors handling will not be enabled if the user is explicitly trying to disable it. |
Describe the bug
Some config options are set by sveltekit and are not warned if they are overriding user-supplied vite options, though other options do have warnings enabled.
For example, the svelte plugin explicitly sets
server.cors
andpreview.cors
to{ preflightContinue: true }
. This fails to report an overridden config if the user configuration was eithercors: false
orcors: { preflightContinue: false }
.Reproduction
https://stackblitz.com/edit/sveltejs-kit-template-default-l9njmw
This has
server.cors
set to{ preflightContinue: false }
andpreview.cors
set tofalse
. Both are overriden with no warning.Logs
Severity
annoyance
Additional Information
No response
The text was updated successfully, but these errors were encountered: