Closed mpellerin42 closed 1 year ago
Hi, this library was created before ESM existed and uses CommonJS. Since this module exports only a single function, there are no significant size savings to be made with tree shaking, so I don't intend to spend the time to upgrade it to ESM.
Bundlers should be able to translate appropriately. If there are issues one option can be to use a modern bundler like Bun which handles ESM and CJS together in a compatible way.
If anyone wants to create ESM variant I suggest to fork and publish a new package.
I've been thinking I could transition to ESM-only and bump the major version and CJS would still be available as a previous version for compatibility reasons. I will see what I can do.
I published the 2.0.0 version that uses ESM.
In our project, we're using latinize to slugify some text (like here). We are in an ESM context, and we import latinize accordingly:
and still, when building an angular application using this utility function, we get the following warning:
I guess the problem comes from latinize having only one
latinize.js
output, probably containing ESM, commonJS and AMD version all together? Would it be possible to package latinize in different files supporting the different modules to avoid this problem and get the most out for ESM usage (like proper tree shaking)?