react-force-graph icon indicating copy to clipboard operation
react-force-graph copied to clipboard

Cannot use import statement outside a module for react-kapsule from react-force-graph-2d

Open chkp-maksimz opened this issue 1 year ago • 4 comments

Describe the bug Error "Cannot use import statement outside a module for react-kapsule from react-force-graph-2d"

To Reproduce Steps to reproduce the behavior:

  1. Run tests

Expected behavior No error

Screenshots image image

Desktop (please complete the following information):

  • OS: Windows

Additional context

chkp-maksimz avatar Feb 21 '24 15:02 chkp-maksimz

@chkp-maksimz it looks like you're trying to import this module in a commonJs environment. This is an ES module and should be imported as such. It does not expose a commonJs entry point.

vasturiano avatar Feb 21 '24 21:02 vasturiano

@vasturiano I use import like this image Could you give an example how should I do import?

chkp-maksimz avatar Feb 22 '24 07:02 chkp-maksimz

Those imports are correct. I suppose the issue is that your tests framework is running in a commonJs environment. They need to be ES modules based.

vasturiano avatar Feb 22 '24 13:02 vasturiano

Following as I get the same error on MacOS

annette-graham avatar Feb 29 '24 11:02 annette-graham