migliori / universal-icon-picker

Vanilla JS Icon Picker for any Icon Library
https://universal-icon-picker.miglisoft.com
MIT License
78 stars 9 forks source link

ES6 import #12

Closed webbird closed 1 year ago

webbird commented 1 year ago

Hi there, I really like this icon picker, so I am trying to use 'import' to use it with webpack, but it gives me an error:

Uncaught TypeError: this.selector is undefined

I am not very familiar with JS and ES6. I tried several variants of

import * as UniversalIconPicker from ...

but I cannot get this working...

migliori commented 1 year ago

Hi,

I whish I could help you but it would take time to set this up and then tell you how to proceed and unfortunately I can't deal with it at the moment.

webbird commented 1 year ago

Maybe there's someone who knows how to do this. :D

migliori commented 1 year ago

Definitely. You may ask on Stackoverflow, I'm sure you'll find someone who will be interested in helping you with this.

webbird commented 1 year ago

As far as I understand this

https://lea.verou.me/2020/07/import-non-esm-libraries-in-es-modules-with-client-side-vanilla-js/

a JavaScript that is loaded as a module with import cannot use this because this will be undefined then. This would explain the error message. Maybe I can get this running by changing your JS a little, if so, I will send you a PR.