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

Usage for Typescript / ES6 Error #94

Open
mortonmills opened this issue May 28, 2024 · 2 comments
Open

Usage for Typescript / ES6 Error #94

mortonmills opened this issue May 28, 2024 · 2 comments

Comments

@mortonmills
Copy link

I'm fairly new to working with packages and modules,
but I received an error in Node when using the Typescript / ES6 syntax
as shown in the Usage section of the README.

import { JZZ } from 'jzz';
         ^^^
SyntaxError: Named export 'JZZ' not found. The requested module 'jzz' is a CommonJS module, 
which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'jzz';
const { JZZ } = pkg;

    at ModuleJob._instantiate (node:internal/modules/esm/module_job:123:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:189:5)

Node.js v19.9.0

@jazz-soft
Copy link
Owner

Hi! Thanks for asking!
Short answer - do as your compiler suggests.
Longer story - please let me know what is your full build setup.

@mortonmills
Copy link
Author

For the error post above, I was experimenting with the different usages for JZZ.
After installing the package with npm,
I made a test.mjs file that I tried to run with nodejs.

import { JZZ } from 'jzz';
console.log(JZZ)

then command line

node test.mjs

Also, wanted to mention that JZZ and the other modules, tiny synth, karaoke, gui player
have been incredibly useful for my projects.
Thank you for making these available.

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

2 participants