File tree 3 files changed +4
-1
lines changed
3 files changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ <h1>Define</h1>
11
11
< p > spread array: < code class ="spread-array "> </ code > </ p >
12
12
13
13
< script type ="module ">
14
+ const __VAR_NAME__ = true // ensure define doesn't replace var name
14
15
text ( '.exp' , __EXP__ )
15
16
text ( '.string' , __STRING__ )
16
17
text ( '.number' , __NUMBER__ )
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ module.exports = {
15
15
}
16
16
}
17
17
} ,
18
+ __VAR_NAME__ : false ,
18
19
'process.env.SOMEVAR' : '"SOMEVAR"'
19
20
}
20
21
}
Original file line number Diff line number Diff line change @@ -67,7 +67,8 @@ export function definePlugin(config: ResolvedConfig): Plugin {
67
67
return str . replace ( / [ - [ \] / { } ( ) * + ? . \\ ^ $ | ] / g, '\\$&' )
68
68
} )
69
69
. join ( '|' ) +
70
- ')\\b' ,
70
+ // prevent trailing assignments
71
+ ')\\b(?!\\s*?=[^=])' ,
71
72
'g'
72
73
)
73
74
You can’t perform that action at this time.
0 commit comments