Skip to content
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

Replace config.kit.vite with vite.config.js #5255

Closed
Rich-Harris opened this issue Jun 24, 2022 · 1 comment
Closed

Replace config.kit.vite with vite.config.js #5255

Rich-Harris opened this issue Jun 24, 2022 · 1 comment

Comments

@Rich-Harris
Copy link
Member

Describe the problem

We just merged #5094, which means it's possible to think of SvelteKit as just another Vite plugin:

// vite.config.js
import { sveltekit } from '@sveltejs/kit/experimental/vite';

/** @type {import('vite').UserConfig} */
const config = {
  plugins: [sveltekit()]
};

export default config;

Svelte/SvelteKit config still goes in svelte.config.js (otherwise e.g. editor integrations won't know how to use the right preprocessors), but if a vite.config.js exists then config.kit.vite will be ignored.

The value of this is that we can use things like vitest without any weirdness.

Describe the proposed solution

If we decide that we like this approach (and I think we probably will) then it would make sense to make some changes:

  • Make vite.config.js mandatory
  • Add it to project templates
  • Get rid of config.kit.vite
  • Move @sveltejs/kit/experimental/vite to @sveltejs/kit/vite or @sveltejs/vite-plugin-sveltekit
  • More controversially, we might want to get rid of svelte-kit dev/build/preview in favour of using vite dev/build/preview. This would mean that SvelteKit itself would no longer have a dependency on Vite, other than in the plugin; apps themselves would need to have a devDependency on vite
  • Consequently, figure out how to handle versions. It's likely that SvelteKit will expect a particular version of Vite, which might mean it needs to become a peerDependency if it's no longer a dependency (though if it's possible to avoid depending on a specific version, that would be ideal)

Alternatives considered

Keep things as they are

Importance

would make my life easier

Additional Information

We should spend a bit of time with @sveltejs/kit/experimental/vite before leaping to any conclusions.

@benmccann
Copy link
Member

Closing as duplicate of #5184

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants