michaelwittig/node-i18n-iso-countries

ESM, Import fails with "The requested module 'i18n-iso-countries' does not provide an export named 'toAlpha2'"

Closed this issue · 1 comments

Hi, thanks for this library.

Importing any utility from this library using ESM modules ("type": "module" in package.json) fails with the following error:

image

I assume that's because entry-node.js defines module.exports dynamically.

This is how I use it: import { toAlpha2 } from 'i18n-iso-countries';.

It would be nice if ESM would be supported as well.

Resolved it via const { toAlpha2 } = (await import('i18n-iso-countries')).default;, it would be good though to use it without side effects.