关于vue3:Vite-because-the-content-contains-invalid-JS-syntax

Vue3 在采纳 compositionAPI 时候,Vite编译报错:

[vite] Internal server error: Failed to parse source for import analysis because the content contains invalid JS syntax. If you are using JSX, make sure to name the file with the .jsx or .tsx extension.

我遇到的报错起因是因为:

async setup(props) { // setup后面用async 异步关键字需注意阻塞危险
    
 
    await XXXX; // await前面 异步呈现阻塞 导致报错 
}


最好间接用Vue3 script-setup 语法糖去写 Vue3 script-setup语法

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理