File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -110,6 +110,7 @@ const nodeConfig = defineConfig({
110
110
external : [
111
111
/ ^ v i t e \/ / ,
112
112
'fsevents' ,
113
+ 'rollup/parseAst' ,
113
114
'rolldown/parseAst' ,
114
115
'rolldown/experimental' ,
115
116
/ ^ t s x \/ / ,
Original file line number Diff line number Diff line change @@ -119,6 +119,10 @@ export function throwClosedServerError(): never {
119
119
throw err
120
120
}
121
121
122
+ // NOTE: add a env var to use parseAst from rollup for now
123
+ const useLegacyParseAst = ! ! process . env . VITE_USE_LEGACY_PARSE_AST
124
+ let legacyParseAst : typeof import ( 'rollup/parseAst' ) . parseAst
125
+
122
126
export interface PluginContainerOptions {
123
127
cwd ?: string
124
128
output ?: OutputOptions
@@ -141,6 +145,9 @@ export async function createEnvironmentPluginContainer(
141
145
plugins ,
142
146
watcher ,
143
147
)
148
+ if ( useLegacyParseAst ) {
149
+ legacyParseAst = await import ( 'rollup/parseAst' ) . then ( ( mod ) => mod . parseAst )
150
+ }
144
151
await container . resolveRollupOptions ( )
145
152
return container
146
153
}
@@ -578,6 +585,9 @@ class PluginContext
578
585
}
579
586
580
587
parse ( code : string , opts : any ) {
588
+ if ( useLegacyParseAst ) {
589
+ return legacyParseAst ( code , opts )
590
+ }
581
591
return rolldownParseAst ( code , opts )
582
592
}
583
593
You can’t perform that action at this time.
0 commit comments