Closed renegarcia225 closed 6 months ago
@renegarcia225 Hi, can you give a minimal reproducible example?
But generally, I think that's cause jest isn't compatible with esm module, And this isn't only related to Neodrag,
so consider going through the instructions from the jest documentation to be able to run Jest in esm: https://jestjs.io/docs/ecmascript-modules
You also can consider migrating to vitest
as its API is 99% compliant with jest
and supports esmodules.
Agreed. We won't be shipping a CJS version, so I'd suggest figuring out a way to run ESM libs in Jest.
When running a Jest test i'm getting the following error:
SyntaxError: Cannot use import statement outside a module
This is how i'm importing the library:
import { useDraggable, DragEventData, DragOptions } from '@neodrag/react';
Seems like
useDraggable
is implemented as an esm moduel which is not compatible with jest.