SyntaxError: Unexpected token export
Hi
Why can't I import directly in Jest?
code:
import fitty from 'fitty';
Throw error:

I found a solution: u must change your import to
import fitty from 'fitty/dist/fitty.min.js'
it works perfectly for me
@vlad909 yup, thanks, that’s what I did.
@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");
Such a non-elegant solution. Someone who works on the library may consider submitting a PR to fix this.
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 😉
Actually just change the primary entry point in package.json from dist/fitty.module.js to dist/fitty.min.js is okay
Updated
main now points to fity.min.js
module now points to fitty.module.js