rapideditor/country-coder

Fully ESM compatible ?

Closed this issue · 0 comments

tzhf commented

First of all thanks a lot for this awesome lib. I was using codegrid but it's not maintained anymore and yours offers so much more features.

I'm using it in a Vue + Vite project, iso1A2Code() works like a charm and returns the country code, but everytime i'm passing {level: 'territory'} i'm getting this error, same for iso1A2Codes(), features() and more.
image

I guess it's probably be some esm issues,
I changed the vite config to optimizeDeps: { exclude: [ '@ideditor/country-coder' ] }
but now i'm getting this: Uncaught SyntaxError: The requested module '/node_modules/which-polygon/index.js?v=3baa6ba3' does not provide an export named 'default'.
To me it seems to come from which-polygon, i took a look at the source code and they seem to use commonJS. I've read vite may have similar issues because of librairies not fully ESM compatibles.
You can close this issue it's probably me and my lack of knowledge, but if anyone has a solution to this let me know !

Thanks