country-list icon indicating copy to clipboard operation
country-list copied to clipboard

Convert project to esm

Open TrySound opened this issue 5 years ago • 10 comments

In this diff I migrated the project to esm and provided module field which is useful for bundlers.

My usecase is rollup. It is able to handle only esm. And this package requires me to add commonjs and json plugins.

As a side bonus this module can be used in browsers without bundlers similar to this https://unpkg.com/jss@next?module.

For tap I wasn't able to setup esm so I replaced it with tape.

TrySound avatar Jun 16 '19 22:06 TrySound

Hi @fannarsh! What do you think about this change?

TrySound avatar Jun 20 '19 15:06 TrySound

Hi @TrySound I'm quite busy at the moment, but I should be able to take a look at this after this weekend.

fannarsh avatar Jun 20 '19 16:06 fannarsh

Friendly ping @fannarsh if you have some time :)

TrySound avatar Jun 25 '19 09:06 TrySound

Hi again, if you want I can split migrating to tape in a separate PR for simpler review.

TrySound avatar Jul 05 '19 10:07 TrySound

Hi, sorry for the late comment, I got side tracked the other day and forgot to come back to this. The PR itself is fine, thanks for that. But I have decided that I'm not going to convert the project to esm. Although I will look into providing a esm build for it.

(I'm not going to close the PR right away, I might change my mind.)

fannarsh avatar Jul 05 '19 10:07 fannarsh

Let me know if you need to clarify something.

TrySound avatar Jul 05 '19 10:07 TrySound

I just found that tap supports esm out of the box. I reverted tape back to tap.

TrySound avatar Aug 12 '19 22:08 TrySound

Any reason this hasn't been merged?

I just searched around and I haven't been able to find an ISO 3166-1-alpha-2 country code package that provides ES modules.

I do think there's an opportunity to provide data like country and language ISO codes but avoid bloating bundle sizes.

sebinsua avatar Jan 30 '20 12:01 sebinsua

@fannarsh: you mentioned you'd take a look at providing an esm build? In the upcoming Angular 10 there is now a warning against including CommonJS packages in your dependencies so I'm guessing this issue will get more tracking soon.

Warning message as found in the output of the Angular 10 build:

WARNING in /file.ts depends on country-list. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://web.dev/commonjs-larger-bundles

Timebutt avatar May 23 '20 10:05 Timebutt

Any update on this?

VictorRibeiroKCX avatar Dec 05 '23 17:12 VictorRibeiroKCX