我在使用 electron-vue 开发时碰到这个问题:
> 我在一个文件中定义一个 async 函数,然后按 commonJS 规范暴露出去。该代码如下:
```
async function testAsync(){
var a = 1;
await a+2;
return a
}
module.exports = {
test
}
```
>但是报一个这样的错:TypeError: Cannot assign to read only property 'exports' of object '#<Object>'
>而当我去掉该函数的 async 以及 await 关键字之后又正常了。。。有点蒙蔽。。。
> 我在一个文件中定义一个 async 函数,然后按 commonJS 规范暴露出去。该代码如下:
```
async function testAsync(){
var a = 1;
await a+2;
return a
}
module.exports = {
test
}
```
>但是报一个这样的错:TypeError: Cannot assign to read only property 'exports' of object '#<Object>'
>而当我去掉该函数的 async 以及 await 关键字之后又正常了。。。有点蒙蔽。。。