gigobyte / purify

Functional programming library for TypeScript - https://gigobyte.github.io/purify/
ISC License
1.52k stars 59 forks source link

Add ES modules in the npm package #604

Closed semmel closed 2 years ago

semmel commented 2 years ago

For the benefit of JavaScript users, please consider to compile to ES modules for distribution via npm. What I mean is essentially the same what has been attempted in #293 , which was later reverted.

Would you consider ES2020 output as third build target and include that in npm publish? If not, could you explain why keep distributing an ES5 output while those runtimes (IE, old Node) should be gone by now?

Background:

gigobyte commented 2 years ago

Hi! I'm fine with a third output target but as far as I can remember the blocker for that issue was that you need to add "type": "module" to package.json which would break all other outputs.

What do you think?

EDIT: Regarding why the ES5 output is still the default, the answer is very simple - most people are not on the latest node and their build setup is not configured to handle uncompiled dependencies. Even tools like jest haven't caught up to this and you need to use transformIgnorePatterns otherwise your tests aren't going to run. It's going to take years for type: "module" to become the standard.

semmel commented 2 years ago

I'll give it a try without type: "module"

semmel commented 2 years ago

@gigobyte Could you review PR #605 ?

gigobyte commented 2 years ago

Available in 1.3.0