SyntaxError: Unexpected token 'export'
Closed this issue · 6 comments
robingenz commented
Is this a regression?
No
Description
I would like to use this library in NodeJS. Unfortunately, I get an error message (see below) when I run the following code:
import { cat } from '@ngneat/falso';
console.log(cat());
Please provide a link to a minimal reproduction of the bug
https://stackblitz.com/edit/node-q73wut?file=index.ts
Please provide the exception or error you saw
❯ npx ts-node index.ts
/home/projects/node-q73wut/node_modules/@ngneat/falso/src/index.js:1
export { zipCode } from './lib/zip-code';
^^^^^^
SyntaxError: Unexpected token 'export'
at wrapSafe (https://node-q73wut.w.staticblitz.com/blitz.528f704493b63b14b6f9ee36935eead8382e8395.js:6:166885)
at Module._compile (https://node-q73wut.w.staticblitz.com/blitz.528f704493b63b14b6f9ee36935eead8382e8395.js:6:167517)
at Object.Module._extensions..js (https://node-q73wut.w.staticblitz.com/blitz.528f704493b63b14b6f9ee36935eead8382e8395.js:6:168239)
at Module.load (https://node-q73wut.w.staticblitz.com/blitz.528f704493b63b14b6f9ee36935eead8382e8395.js:6:166317)
at Function.Module._load (https://node-q73wut.w.staticblitz.com/blitz.528f704493b63b14b6f9ee36935eead8382e8395.js:6:163857)
at Module.require (https://node-q73wut.w.staticblitz.com/blitz.528f704493b63b14b6f9ee36935eead8382e8395.js:6:166635)
### Please provide the environment you discovered this bug in
```true
URL: https://stackblitz.com/edit/node-q73wut?file=index.ts
~/projects/node-q73wut
❯ node -v
v14.16.0
~/projects/node-q73wut
❯ npm -v
7.17.0
### Anything else?
_No response_
### Do you want to create a pull request?
No
NetanelBasal commented
We need to build a cjs version. I'll do it asap.
NetanelBasal commented
You can use the esm version with Node in the meantime. https://nodejs.org/api/esm.html
robingenz commented
That was fast! Thank you very much! 😄
NetanelBasal commented
NetanelBasal commented
Can you please check the latest version?
robingenz commented
Works! 👍 Thank you!