Babel 7 升级创建错误:"TypeError: Cannot assign to read only property 'exports' of object '#<Object&g



我正在从 babel 6 升级到 babel 7。我使用柴,西农和酶的一些旧测试出现了以下错误:

TypeError: Cannot assign to read only property 'exports' of object '#<Object>'

我确实有一些代码使用"require"而不是"export",我知道 babel 7 文档说您可能需要使用"require((.default"。但这似乎没有帮助。(或者我只需要完成在所有位置放置默认值并在任何错误消失之前调用它们(。还有其他人对这个问题有经验吗?

尽量不要require / module.exportsimport / export混为一谈,确保与一个保持一致。

最新更新