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: omit 'plugins' since it has no effect #13879

Merged
merged 1 commit into from
Sep 14, 2023
Merged

Conversation

gulewei
Copy link
Contributor

@gulewei gulewei commented Jul 17, 2023

Description

Since it's noted that injecting other plugins inside the config hook will has no effect, I think we should let the type also saids so to keep users from doing this. It could be very confusing when people didn't see the note.

Additional context


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

type enhancement

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the PR Title Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@stackblitz
Copy link

stackblitz bot commented Jul 17, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@gulewei gulewei changed the title types: omit 'plugins' since it has no effect fix: omit 'plugins' since it has no effect Jul 17, 2023
@patak-dev
Copy link
Member

I think we could do this change in Vite 5, to avoid messing with the types in a patch.

@patak-dev patak-dev added the p3-minor-bug An edge case that only affects very specific usage (priority) label Jul 17, 2023
@patak-dev patak-dev added this to the 5.0 milestone Jul 17, 2023
@gulewei
Copy link
Contributor Author

gulewei commented Jul 18, 2023

I think we could do this change in Vite 5, to avoid messing with the types in a patch.

However, it seems doesn't break anything:

  1. as noted, nobody could inject plugins right now
  2. the type is still compatible
type T1 = UserConfig;
type T2 = Omit<UserConfig, 'plugins'>;

type R1 = (() => T1 | Promise<T1>) extends (() => T2 | Promise<T2>) ? true : false; // true
type R2 = (() => T2 | Promise<T2>) extends (() => T1 | Promise<T1>) ? true : false; // true

@patak-dev
Copy link
Member

Hey @gulewei, I already reviewed this PR. We should let others check it out and merge it.

@patak-dev patak-dev removed their request for review September 14, 2023 08:50
@patak-dev
Copy link
Member

/ecosystem-ci run

@vite-ecosystem-ci
Copy link

vite-ecosystem-ci bot commented Sep 14, 2023

📝 Ran ecosystem CI: Open

suite result
analogjs ✅ success
astro ✅ success
histoire ❌ failure
ladle ✅ success
laravel ✅ success
marko ✅ success
nuxt ✅ success
nx ✅ success
previewjs ✅ success
qwik ✅ success
rakkas ✅ success
sveltekit ✅ success
unocss ✅ success
vite-plugin-pwa ✅ success
vite-plugin-ssr ✅ success
vite-plugin-react ✅ success
vite-plugin-react-pages ✅ success
vite-plugin-react-swc ✅ success
vite-plugin-svelte ✅ success
vite-plugin-vue ✅ success
vite-setup-catalogue ✅ success
vitepress ❌ failure
vitest ✅ success

@patak-dev patak-dev merged commit 64888b0 into vitejs:main Sep 14, 2023
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants