-
-
Notifications
You must be signed in to change notification settings - Fork 915
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' #488
Comments
This point is not clear. Is it node project or some bundler, which bundler?
|
It is node project... I guess it happens because of my node written in commonJs and uuid is es6! |
Nope. UUID is distributed as commonjs by default. How do you import uuid? And provide please minimal reproduction. |
But my console shows an error node_modules\uuidv4\node_modules\uuid\dist\esm-browser\index.js:1
export { default as v1 } from './v1.js';
^^^^^^
SyntaxError: Unexpected token 'export'
at compileFunction (<anonymous>)
at wrapSafe (internal/modules/cjs/loader.js:1116:16)
at Module._compile (internal/modules/cjs/loader.js:1164:27) which pointed to this file: export { default as v1 } from './v1.js';
export { default as v3 } from './v3.js';
export { default as v4 } from './v4.js';
export { default as v5 } from './v5.js'; What am i missing here? |
Show how do you import uuid, give us a reproduction. |
This is how i import: const { uuid } = require('uuidv4'); |
This package? |
The wrong one. Please read documentation. |
I see. This package is the dependency of your one. Could you switch to using |
Closing since this seems to be related to a reverse dependency of this package. Please open a bug report in the appropriate issue tracker if the problem persists: https://github.com/thenativeweb/uuidv4/ |
Hey folks, I think this still might be an issue, getting exactly the same problem, importing uuid directly. Made a repo here to show the problem. Versions:
Hope it helps |
@riccardoNovaglia your node version has incomplete support for the Please upgrade to Node.js |
@ctavan absolutely right. Can confirm it works with both v12 and v14. Thanks for the help! |
update your node. i had the same problem using node 13.3.0 and uuid 8.3.0. then i upgraded to node 14.12.0 and it worked |
const { v4 : uuidv4 } = require('uuid'); export { default as v1 } from './v1.js'; How can I solve this? |
@RatonBiswas Why do you mix commonjs and es modules? |
yes, you are right. |
if it is still not running after updated node, try update uuid npm install uuid |
I still have this issue |
@guillefix please see: #488 (comment) |
Describe the bug
It seems there is a problem with exporting different versions inside of uuid. My project is using uuidv4 which is using uuid.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Expected to run without problem.
Runtime
Additional context
You can see the error here:
The text was updated successfully, but these errors were encountered: