Search code examples
javascriptwebpackcypresslerna

cypress + lerna: ParseError: 'import' and 'export' may appear only with 'sourceType: module'


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.


Solution

  • You need to actually install the preprocessor in your project, not just its peer dependencies: npm install --save-dev @cypress/webpack-preprocessor