sindresorhus/file-type

`SyntaxError: Cannot use import statement outside a module` When running in Jest

EricHasegawa opened this issue · 1 comments

I'm using file-type ^19.0.0, I have a line in my file import { fileTypeFromBuffer } from 'file-type' that causes this error when I run jest over this file.
` ({"Object.":function(module,exports,require,__dirname,__filename,jest){import * as strtok3 from 'strtok3';
^^^^^^

SyntaxError: Cannot use import statement outside a module`

Here's an identical issue on Stack Overflow from a year ago https://stackoverflow.com/questions/74917081/jest-error-while-trying-to-use-with-the-file-type-module-how-can-i-fix-cannot

This is a problem with your Jest config, not this package.