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: Unexpected token export #76

Open
7zf001 opened this issue Oct 1, 2021 · 7 comments
Open

SyntaxError: Unexpected token export #76

7zf001 opened this issue Oct 1, 2021 · 7 comments

Comments

@7zf001
Copy link

7zf001 commented Oct 1, 2021

Hi

Why can't I import directly in Jest?

code:

import fitty from 'fitty';

Throw error:
image

@vlad909
Copy link

vlad909 commented Dec 15, 2021

I found a solution: u must change your import to
import fitty from 'fitty/dist/fitty.min.js'
it works perfectly for me

@7zf001
Copy link
Author

7zf001 commented Dec 16, 2021

@vlad909 yup, thanks, that’s what I did.

@maxfriedmann
Copy link
Contributor

@vlad909's solution did not work for me since typescript would complain about missing types.

Ugly workaround for me:

// eslint-disable-next-line @typescript-eslint/no-var-requires
const fitty = require("fitty/dist/fitty.min.js");

@varunarora
Copy link

Such a non-elegant solution. Someone who works on the library may consider submitting a PR to fix this.

@flexbox
Copy link

flexbox commented Jan 24, 2023

Such a non-elegant solution. Someone who works on the library may consider submitting a PR to fix this.

@varunarora feel free to do it 😉

@chou0728
Copy link
Contributor

Actually just change the primary entry point in package.json from dist/fitty.module.js to dist/fitty.min.js is okay

@rikschennink
Copy link
Owner

Updated

main now points to fity.min.js

module now points to fitty.module.js

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

7 participants