Skip to content

Commit

Permalink
fix(scan): handle await replacement edge case
Browse files Browse the repository at this point in the history
fix #2528
  • Loading branch information
yyx990803 committed Mar 16, 2021
1 parent 407ce3b commit cbfc3e9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/vite/src/node/optimizer/scan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ function esbuildScanPlugin(
// <script setup> may contain TLA which is not true TLA but esbuild
// will error on it, so replace it with another operator.
if (js.includes('await')) {
js = js.replace(/\bawait\s/g, 'void ')
js = js.replace(/\bawait(\s)/g, 'void$1')
}

if (!js.includes(`export default`)) {
Expand Down

0 comments on commit cbfc3e9

Please sign in to comment.