Navigation Menu

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: apply condition skipped for nested plugins #7741

Merged
merged 1 commit into from Apr 15, 2022

Conversation

brillout
Copy link
Contributor

Description

The code implementing the apply() condition is broken for nested plugins. This PR fixes it.

Additional context

The Vilay framework uses vite-plugin-ssr. Both use an array of plugins.

Se we end up with:

// vite.config.js (user config)
plugins: [vilay()]
// Vilay plugin
export function vilay(): Plugin[] {
  return [
    ssr() // vite-plugin-ssr
    // Vilay uses more plugins
    // ...
  ]
}
// vite-plugin-ssr plugin
export function ssr(): Plugin[] {
  return [
    // Uses several plugins
  ]
}

Vite receives a nested plugin array of depth 3.


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

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

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the Commit 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.

I don't think a test is worth it for this.

@patak-dev
Copy link
Member

Thanks for the fix. Amazing that this wasn't discovered before.

@brillout I imagine you'll do it once you feel it is the right time, but I would love to read a blog post about the vite-plugin-ssr ecosystem and related projects.

@patak-dev patak-dev merged commit 1f2ca53 into vitejs:main Apr 15, 2022
@brillout
Copy link
Contributor Author

@patak-dev Yes and, in general, writing more blog posts and focusing more on marketing/communication is something I'm looking forward to :-). And yea, as you rightfully imagined :-), I'll do it when the time is right.

(Btw. I will re-create the vite preview PR tentatively today / this weekend.)

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.

None yet

3 participants