sudodoki / copy-to-clipboard

Copy stuff into clipboard from your browser using JS
http://sudodoki.github.io/copy-to-clipboard/example/
MIT License
1.27k stars 132 forks source link

not es-module compliant #128

Open vdegenne opened 1 year ago

vdegenne commented 1 year ago

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 commented 1 year ago

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

vdegenne commented 1 year ago

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