Cypress ParseError: 'import' and 'export' may appear only with 'sourceType: module'

后端 未结 5 1393
星月不相逢
星月不相逢 2021-01-11 14:56

I updated Cypress from 3.0.3 to 3.1.3. Im using ES6 import/export modules which must be working related to docs. But Im getting a line with u

5条回答
  •  庸人自扰
    2021-01-11 15:49

    There is an official sample on github available at this address https://github.com/cypress-io/cypress-example-recipes/tree/master/examples/preprocessors__typescript-webpack

    Note: if you are on windows and want to run localy the project, first update the path in the package.json.

    // D:\path\cypress-example-recipes\examples\preprocessors__typescript-webpack\package.json
    
    {
      "name": "cypress-example-typescript-webpack",
      "version": "1.0.0",
      "description": "Example showing TypeScript tests with Cypress",
      "scripts": {
        // ...
        "cypress:open": "..\\..\\node_modules\\.bin\\cypress open"
      }
    }
    

提交回复
热议问题