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 importing fetchMock from fetch-mock #659

Open
flixman opened this issue Sep 30, 2023 · 2 comments

Comments

@flixman
Copy link

flixman commented Sep 30, 2023

I am a newbee with fetch-mock, using jest for a React code, on typescript (targetting ESNext). I am getting the following error, which I do not understand:

/home/user/Documents/project/node_modules/node-fetch/src/index.js:9
    import http from 'node:http';
    ^^^^^^

    SyntaxError: Cannot use import statement outside a module

I have followed the advise for jest for typescript, using babel and so... but I cannot get this to work. Any idea on what might be wrong?

@msiden-wl
Copy link

Seeing this exact same issue (only on JS code). Tried everything I can find online with no luck.

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

3 participants