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 3
3
## Unreleased
4
4
5
5
- Add support for Vite base path
6
+ - Use filter hook for better performance in rolldown-vite
6
7
7
8
## 4.0.0
8
9
Original file line number Diff line number Diff line change @@ -21,15 +21,19 @@ export const reactClickToComponent = (): PluginOption => ({
21
21
. replace ( "__BASE__" , base ) ,
22
22
} ,
23
23
] ,
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
+ } ,
34
38
} ,
35
39
} ) ;
You can’t perform that action at this time.
0 commit comments