bestiejs / platform.js

A platform detection library.
https://mths.be/platform
MIT License
3.22k stars 408 forks source link

Deliver an esm version #192

Open jehon opened 3 years ago

jehon commented 3 years ago

Nodejs and the browser now fully support the "import ... / export ... " syntax.

Will this package be migrated to?

bnjmnt4n commented 3 years ago

Right now, platform.js is a written with CommonJS, so there might not be much benefits in terms of just providing a ESM version, although I might look into that in the future. An ESM version also isn't likely to improve tree-shaking.

julianpoemp commented 3 years ago

Angular warns users about commonjs packages and says that it could lead to optimization bailouts.

It would be nice to have platformjs as es6 module. E.g. you could convert the project to a Typescript  project and build it with rollup.js. After that you get a commonjs ( and a minified version) and a es6 module automatically. @bnjmnt4n please have a look on my tsrollupjs-sample project. It's very easy to migrate and Typescript is easy to learn.

raiyni commented 3 years ago

ESM version would be beneficial for svelte users, otherwise this library can't be used there.

Dinika commented 1 year ago

Are there any updates on this? I wanted to use this for a react project in my team and not having an esm version makes it difficult.