jklmli / monapt

Options, Tries, and Futures for JavaScript / TypeScript
MIT License
172 stars 13 forks source link

Distribute files for each type #19

Open OliverJAsh opened 7 years ago

OliverJAsh commented 7 years ago

The npm package currently only distributes one large JS file, including all types.

It would be great if it distributed a file for each type.

This would allow us to include Option in our codebase, if that's the only type being used, for example.

jklmli commented 7 years ago

What would this look like? import * as Option from 'monapt/option'? I haven't tried this, but have you tried tree-shaking with import { Option } from 'monapt'?

OliverJAsh commented 7 years ago

import * as Option from 'monapt/option'?

That's what I was thinking!

I haven't tried this, but have you tried tree-shaking with import { Option } from 'monapt'?

I haven't tried it, but it would be great to have the separate file in any case, for when the module is imported in a module system that doesn't support tree shaking, e.g. CommonJS instead of ES Modules.

jklmli commented 7 years ago

I haven't tried it, but it would be great to have the separate file in any case, for when the module is imported in a module system that doesn't support tree shaking, e.g. CommonJS instead of ES Modules.

Hmm...that's a good point. I'll see if I can come up with something.