-
-
Notifications
You must be signed in to change notification settings - Fork 111
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
refactor: move plugin options to "vitePlugin" in svelte.config.js #389
Conversation
Are you planning on supporting both for a while? there have been so many breaking changes in svelte projects recently it might be nice to have a break 😅 |
No, this is breaking. But it should be the last one before vite-plugin-svelte 1.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some spacing nits, but the src looks good to me. Maybe we also want to export a new type for vitePlugin
? Currently we have Options
that's for passing the the plugin directly.
Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
@bluwy, @dominikg Is this change available in the recent v1.0.1 release? When I wrap my options under
I'm seeing the following warning in the console:
|
inline in vite config you do not wrap them. Only in svelte.config.js |
Ah, sorry. Yes, I've just read https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/config.md#experimental-options where is mentioned that this change is only for svelte.config.js. This is kind of confusing to be honest and would be better to be consistent. Furthermore the example at the top of the page has this: // vite.config.js
export default defineConfig({
plugins: [
svelte({
configFile: false
// your svelte config here
})
]
}); where I thought because of |
Imho vitePlugin would be redundant inside vite.config.js inline options. It is used in svelte.config.js because that file isn't exclusive for vite-plugin-svelte. |
@dominikg Fair enough, I agree. It is just a little confusing and some people may stumble on this, but there is also validation for the config, so I think we are OK. |
To avoid problems with future name clashes we introduce
vitePlugin
namespace in svelte.config.js.svelte options that are of global interest, eg
compilerOptions
,preprocess
andextensions
remain in the config root.All other options mentioned in https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/config.md#plugin-options are moved.
Additional validation/errors have been introduced to avoid invalid options and inform the user.