Skip to content

feat: make PluginContext available for Vite-specific hooks #19936

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

sapphi-red
Copy link
Member

Description

Make PluginContext available for Vite-specific hooks.
By making PluginContext available, we have the following upsides:

Each hooks will receive the following plugin context types:

  • config: ConfigPluginContext
  • configEnvironment: ConfigPluginContext
  • configResolved: MinimalPluginContextWithoutEnvironment
  • handleHotUpdate: MinimalPluginContextWithoutEnvironment
  • transformIndexHtml: MinimalPluginContextWithoutEnvironment
  • configureServer: MinimalPluginContextWithoutEnvironment
  • configurePreviewServer: MinimalPluginContextWithoutEnvironment
  • hotUpdate: MinimalPluginContextWithoutEnvironment
  • handleHotUpdate: MinimalPluginContext & { environment: DevEnvironment }

ConfigPluginContext does not have access to this.meta.watchMode and this.environment.
MinimalPluginContextWithoutEnvironment does not have access to this.environment.

@sapphi-red sapphi-red added the p2-nice-to-have Not breaking anything but nice to have (priority) label Apr 25, 2025
Copy link
Member

@patak-dev patak-dev left a comment

Choose a reason for hiding this comment

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

looks like a great API extension to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p2-nice-to-have Not breaking anything but nice to have (priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants