Use plugin hook filters internally in plugin-rsc#957
Closed
Conversation
- plugin-react: Remove redundant filter check since hook filter handles it - plugin-react-swc: Add hook filters for default file extensions (.tsx, .ts, .mts, .jsx, .mdx) - Conditional filter application: Only use filters when parserConfig is not custom Co-authored-by: hi-ogawa <4232207+hi-ogawa@users.noreply.github.com>
Change tsx? to (tsx|ts) to make it clearer that both extensions are matched Co-authored-by: hi-ogawa <4232207+hi-ogawa@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Implement plugin hook filter functionality internally
Use plugin hook filters internally
Oct 28, 2025
- Revert changes to plugin-react and plugin-react-swc (per review feedback) - Add @rolldown/pluginutils dependency to plugin-rsc - Add hook filters to transform hooks: rsc:vite-client-raw-import, rsc:inject-async-local-storage, rsc:rsc-css-self-accept - Add hook filters to resolveId hook: rsc:react-server-dom-webpack-alias - Add hook filters to load hooks: virtual modules for assets-manifest and client-references - Remove redundant conditional checks where hook filters now handle the filtering Co-authored-by: hi-ogawa <4232207+hi-ogawa@users.noreply.github.com>
Contributor
Author
Updated to only apply hook filters to Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
The filter already matches CSS files, so this check is redundant Co-authored-by: hi-ogawa <4232207+hi-ogawa@users.noreply.github.com>
Copilot
AI
changed the title
Use plugin hook filters internally
Use plugin hook filters internally in plugin-rsc
Oct 28, 2025
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Leverage Vite's native hook filter feature (https://vite.dev/guide/api-plugin.html#hook-filters) to optimize file filtering instead of performing redundant checks in handler functions.
Changes
@vitejs/plugin-rsc
@rolldown/pluginutilsas a dependencyrsc:vite-client-raw-import: Filter by code containing__vite_rsc_raw_import__rsc:inject-async-local-storage: Filter by code containingAsyncLocalStoragersc:rsc-css-self-accept: Filter by CSS files with?directquery parameterrsc:react-server-dom-webpack-alias: Filter by id prefix@vitejs/plugin-rsc/vendor/react-server-dom/\0virtual:vite-rsc/assets-manifest\0virtual:vite-rsc/client-referencesExample
Before:
After:
Benefits
Performance improvement: Vite's native filtering is more efficient as it can filter files before calling the handler
Cleaner code: Removes redundant filtering logic where appropriate
Maintains backward compatibility: All existing tests pass
Fixes use plugin hook filter internally #861
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.