perry-mitchell / ulidx

ULID generator for NodeJS and the browser
MIT License
281 stars 17 forks source link

Could you provide esm modules and source code without minification as in original ulid package as dist? #7

Closed budarin closed 1 year ago

budarin commented 2 years ago

I use only one method, but webpack could not do tree shaking on built common module - so the full package code is included in my app instead of some functions

perry-mitchell commented 2 years ago

Hi @budarin - You're right that currently ulidx is packaged as CJS, and this makes it impossible for webpack to treeshake.

Instead of providing a build where the output is just the source code, I would suggest that I support ECMAScript modules. I'd need to make sure that both the CJS and ESM builds can work together in the same package. I don't think publishing the Typescript source is a nice solution, I'd prefer to have to compiled to JS but retaining the module import/export approach.

That being said, I will look at the original ulid package to get some ideas on the different publishing options. That package has been around for a while and has had to serve a lot of different use cases, so I'll try to add compatibility on that front also.

rockfreak commented 2 years ago

This would be great if it was tree shakeable .

Can anyone help assist in this?

perry-mitchell commented 1 year ago

Currently working on an ESM-only build, which will probably be released as v1. It should be ready soon.

bluet commented 1 year ago

ref https://github.com/perry-mitchell/ulidx/pull/18

perry-mitchell commented 1 year ago

ESM+CJS now available in v1