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

not es-module compliant #128

Open
vdegenne opened this issue Mar 16, 2023 · 2 comments
Open

not es-module compliant #128

vdegenne opened this issue Mar 16, 2023 · 2 comments

Comments

@vdegenne
Copy link

Hey nice package, but unfortunately not ESModule-compliant.

You use the import syntax in your documentation, and you even provide TypeScript types, which is a bit misleading because in the hood your script is CommonJS. That's bad practice.
I am having a hard time integrating your lib into my TypeScript project.

You may want to consider turning your script into an ES Module anyway. Modern browsers support modules now it's safe, that means your package wouldn't technically need any compilation, you could just load it into the browser in a module context.
But you still can use it in a compilation process, most transpilers and bundlers understand modules now.

Technically you wouldn't need much headache, just adding "type": "module" in your package.json and changing module.exports = ... to export default ... I guess.

@oeed
Copy link

oeed commented May 7, 2023

This would be great. It's causing a few headaches getting it to work with Vite. See #129

@vdegenne
Copy link
Author

vdegenne commented May 8, 2023

@oeed I opened a PR but this repo is dead. Better fork it or find another one..

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