Skip to content

Commit cbfc3e9

Browse files
committed
fix(scan): handle await replacement edge case
fix #2528
1 parent 407ce3b commit cbfc3e9

File tree

1 file changed

+1
-1
lines changed
  • packages/vite/src/node/optimizer

1 file changed

+1
-1
lines changed

packages/vite/src/node/optimizer/scan.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ function esbuildScanPlugin(
219219
// <script setup> may contain TLA which is not true TLA but esbuild
220220
// will error on it, so replace it with another operator.
221221
if (js.includes('await')) {
222-
js = js.replace(/\bawait\s/g, 'void ')
222+
js = js.replace(/\bawait(\s)/g, 'void$1')
223223
}
224224

225225
if (!js.includes(`export default`)) {

0 commit comments

Comments
 (0)