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

fix: change Vite config type to work with Vitest options #8871

Merged
merged 1 commit into from
Feb 6, 2023
Merged

fix: change Vite config type to work with Vitest options #8871

merged 1 commit into from
Feb 6, 2023

Conversation

eltigerchino
Copy link
Member

closes #8768

As suggested by Rich and Dominik, this changes all vite.config templates to:

  • use defineConfig instead of type annotations.
  • import defineConfig from vitest if the project includes vitest.

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

Copy link
Member

@dummdidumm dummdidumm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a breaking change since it changes the shape of the vite config? If so, we should release it together with the other breaking change (and further breaking changes possibly coming out of the svelte package discussion)

@eltigerchino
Copy link
Member Author

Is this a breaking change since it changes the shape of the vite config?

As in how the config is exported? (changed from exporting the constant to directly exporting the method output).

I'm not sure if it's breaking. It still uses the vite UserConfig type, but gets the type inference from the defineConfig output instead. Only the vitest option has changed to correctly use the superset type from vitest instead of vite.

@dummdidumm
Copy link
Member

It's more along the lines of potential downstream projects like svelte-add modifying that code. @babichjacob is vite.config.js/ts something svelte-add touches/adders could touch?

@Rich-Harris
Copy link
Member

approved, but will hold off merging till we get clarity around svelte-add

@babichjacob
Copy link
Member

Svelte Add is fine with defineConfig - it doesn't even validate that it's from Vite (or even called defineConfig - just that it's a function) so using the one from Vitest is a-ok. Thanks for the heads up, and you can go ahead.

@Rich-Harris Rich-Harris merged commit b02d795 into sveltejs:master Feb 6, 2023
@github-actions github-actions bot mentioned this pull request Feb 6, 2023
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

Successfully merging this pull request may close these issues.

Configuration for vitest not assignable to type UserConfig
4 participants