cypress + lerna: ParseError: 'import' 和 'export' 可能只出现在 'sourceType: module' [英] cypress + lerna: ParseError: 'import' and 'export' may appear only with 'sourceType: module'

查看:64
本文介绍了cypress + lerna: ParseError: 'import' 和 'export' 可能只出现在 '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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆