cypress + lerna: ParseError: 'import' 和 'export' 可能只出现在 'sourceType: module' [英] cypress + lerna: ParseError: 'import' and 'export' may appear only with 'sourceType: module'
问题描述
我目前开始使用 cypress.在测试中,我想从另一个模块导入代码,但它说 ParseError: 'import' 和 'export' 可能只与 'sourceType: module'
一起出现.
我添加了预处理器,如此处所述.>
这里是一个不起作用的存储库.赛普拉斯位于 a
模块中,并从 b
模块导入一个函数.
您需要在项目中实际安装预处理器,而不仅仅是其对等依赖项:npm install --save-dev @cypress/webpack-preprocessor
I currently started working with cypress. In a test I want to import code from another module but it's saying ParseError: 'import' and 'export' may appear only with 'sourceType: module'
.
I've added the preprocessor like it's described here.
Here is a repo that's not working. Cypress is in module a
and importing a function from module b
.
You need to actually install the preprocessor in your project, not just its peer dependencies: npm install --save-dev @cypress/webpack-preprocessor
这篇关于cypress + lerna: ParseError: 'import' 和 'export' 可能只出现在 'sourceType: module'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!