Closed
Description
Vue version
3.3.4
Link to minimal reproduction
Steps to reproduce
在模板的元素的回调中 (如 @click
) 定义异步箭头函数, 并将变量赋值为 await <任意异步函数>
(如 a = await xxx()
) 则在 生产环境build 出现 'await' is only allowed within async functions and at the top levels of modules.
, 但 开发环境 正常可编译通过, 且 VSCode 语法检查没有问题
What is expected?
开发环境与生产环境行为相同, 均可顺利通过 build
What is actually happening?
SyntaxError: Error parsing JavaScript expression: 'await' is only allowed within async functions and at the top levels of modules. (1:1)
System Info
System:
OS: Windows 11 10.0.22631
CPU: (20) x64 Intel(R) Core(TM) i9-10900 CPU @ 2.80GHz
Memory: 15.30 GB / 31.74 GB
Binaries:
Node: 18.20.1 - ~\AppData\Local\Volta\tools\image\node\18.20.1\node.EXE
Yarn: 4.1.1 - ~\AppData\Local\Volta\tools\image\yarn\4.1.1\bin\yarn.CMD
npm: 10.5.0 - ~\AppData\Local\Volta\tools\image\node\18.20.1\npm.CMD
Browsers:
Edge: Chromium (123.0.2420.97)
Internet Explorer: 11.0.22621.1
npmPackages:
vue: ^3.3.4 => 3.4.21
Any additional comments?
nope
Metadata
Metadata
Assignees
Labels
No labels