Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
EricHasegawa opened this issue Jan 18, 2024 · 1 comment

Comments

@EricHasegawa
Copy link

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

@sindresorhus
Copy link
Owner

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

@sindresorhus sindresorhus closed this as not planned Won't fix, can't repro, duplicate, stale Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants