Open KayakinKoder opened 5 years ago
do you "register" the locals you want to use?
countries.registerLocale(require("i18n-iso-countries/langs/en.json"));
i have the opposite problem - how not to bundle all locales? package.json points to entry-node, which requires all locales and registers them.
the short answer is package.json sets "browser": "index"
If your module is meant to be used client-side the browser field should be used instead of the main field. This is helpful to hint users that it might rely on primitives that aren’t available in Node.js modules. (e.g. window)
but I think the way to solve this is replace
countries.registerLocale(require("i18n-iso-countries/langs/en.json"));
with
const {data: locale} = await axios.get('https://unpkg.com/i18n-iso-countries@4.3.1/langs/en.json');
countries.registerLocale(locale);
Just a question, does anyone use this with an ES module bundler (e.g. Rollup)? I've given it a go and can't get things to work.
Package looks great, thanks.