cypress-movie icon indicating copy to clipboard operation
cypress-movie copied to clipboard

ParseError when importing commands in support/index.ts

Open CypressCecelia opened this issue 4 years ago • 4 comments

When using

// cypress/support/index.js
import 'cypress-movie/commands'

I received an error

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

I was able to resolve by importing the commands individually from src instead like

import "cypress-movie/src/toast";
import "cypress-movie/src/clear-viewport";

I'm thinking this is a TS error but I am not familiar enough to be sure. Will continue to research.

CypressCecelia avatar Jul 09 '20 03:07 CypressCecelia

Same here. It doesn't worked even when I added the dependencies like the example above. Someone has a suggestion of how can I solve it?

samlucax avatar Jul 28 '20 23:07 samlucax

Hmm I think I forgot to transpile them to es5 when publishing, sigh

Sent from my iPhone

On Jul 28, 2020, at 19:50, Samuel Lucas [email protected] wrote:

 Same here. It doesn't worked even when I added the dependencies like the example above. Someone has a suggestion of how can I solve it?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

bahmutov avatar Jul 28 '20 23:07 bahmutov

Same problem for me, the workaround worked for me too. In my case, it was:

import "cypress-movie/src/clear-viewport";

I guess this will be solved when a new release of cypress-movie is released with TS code transpiled...

jgbarah avatar Aug 22 '20 09:08 jgbarah

Installing the @cypress/webpack-preprocessor package should also resolve this kind of error

tho-masn avatar Apr 23 '21 08:04 tho-masn