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

ESM modules import does not working #421

Open
zbinlin opened this issue Mar 16, 2024 · 1 comment
Open

ESM modules import does not working #421

zbinlin opened this issue Mar 16, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@zbinlin
Copy link

zbinlin commented Mar 16, 2024

To Reproduce
Steps to reproduce the behavior:

  1. Create new npm project: npm init --yes, and install beautiful-react-hooks.
  2. Add "type": "module" to package.json.
  3. Create an index.js file: import "beautiful-react-hooks/useAudio".
  4. Run node index.js, see error: SyntaxError: Cannot use import statement outside a module.
@antonioru
Copy link
Owner

hey @zbinlin ,

thanks for opening this issue, I've tried to reproduce as you suggested and indeed, the package turns out to be unusable.

This is caused by an incorrect exports management in the package.json that is auto-generated during the build phase.

Please, if you like, try to propose a PR to fix the problem, it would be nice to have you among the contributors...
If you can't manage it, no problem, I'll try to fix it as soon as possible

In the meantime, thanks a lot

@antonioru antonioru added the bug Something isn't working label Apr 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants