File tree Expand file tree Collapse file tree 2 files changed +15
-10
lines changed
Expand file tree Collapse file tree 2 files changed +15
-10
lines changed Original file line number Diff line number Diff line change 33## Unreleased
44
55- Add support for Vite base path
6+ - Use filter hook for better performance in rolldown-vite
67
78## 4.0.0
89
Original file line number Diff line number Diff line change @@ -21,15 +21,19 @@ export const reactClickToComponent = (): PluginOption => ({
2121 . replace ( "__BASE__" , base ) ,
2222 } ,
2323 ] ,
24- transform ( code , id ) {
25- if ( ! id . includes ( "jsx-dev-runtime.js" ) ) return ;
26- if ( code . includes ( "_source" ) ) return ;
27- const defineIndex = code . indexOf ( '"_debugInfo"' ) ;
28- if ( defineIndex === - 1 ) return ;
29- const valueIndex = code . indexOf ( "value: null" , defineIndex ) ;
30- if ( valueIndex === - 1 ) return ;
31- return (
32- code . slice ( 0 , valueIndex ) + "value: source" + code . slice ( valueIndex + 11 )
33- ) ;
24+ transform : {
25+ filter : { id : / j s x - d e v - r u n t i m e \. j s / u } ,
26+ handler ( code ) {
27+ if ( code . includes ( "_source" ) ) return ;
28+ const defineIndex = code . indexOf ( '"_debugInfo"' ) ;
29+ if ( defineIndex === - 1 ) return ;
30+ const valueIndex = code . indexOf ( "value: null" , defineIndex ) ;
31+ if ( valueIndex === - 1 ) return ;
32+ return (
33+ code . slice ( 0 , valueIndex )
34+ + "value: source"
35+ + code . slice ( valueIndex + 11 )
36+ ) ;
37+ } ,
3438 } ,
3539} ) ;
You can’t perform that action at this time.
0 commit comments