uuid: SyntaxError: Unexpected token 'export'
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:
- Install ‘uuidv4’
- Run project (commonJs style)
- See error
Expected behavior
Expected to run without problem.
Runtime
- OS: Win10
- Runtime: Node.js
- Runtime Version: 14.3.0
Additional context
You can see the error here:
...\node_modules\uuidv4\node_modules\uuid\dist\esm-browser\index.js:1
export { default as v1 } from './v1.js';
^^^^^^
SyntaxError: Unexpected token 'export'
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 20 (10 by maintainers)
@riccardoNovaglia your node version has incomplete support for the
package.exportsfeature. It’s also not actively supported by Node.js anymore, see https://nodejs.org/en/about/releases/Please upgrade to Node.js
v14if you want to use ESM or downgrade tov12if you want to use CommonJS.@ctavan absolutely right. Can confirm it works with both v12 and v14. Thanks for the help!
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