geocodeearth / autocomplete-element

A custom element for use with the Geocode Earth Autocomplete API.
https://geocode.earth
MIT License
8 stars 1 forks source link

Package doesn't work in Vue #31

Open gtrusgnich-tempestive opened 7 months ago

gtrusgnich-tempestive commented 7 months ago

I tried to install the library in a Vue project following the guide, but found no way to get it to work. The import via CDN makes it work correctly, but it is not optimal. Would it be possible to make it work with frameworks other than React?

These are the errors I get in console

image

This is a StackBlitz to reproduce the errors https://stackblitz.com/edit/vitejs-vite-3viacn?file=src%2Fcomponents%2FHelloWorld.vue

missinglink commented 7 months ago

I had a quick look at this and it doesn't seem to be simple.

I've created a branch for testing which uses useEffect instead of useDeepCompareEffect but wasn't able to get it to load in stackblitz, it seems to be a known issue.

Are you able to try this locally to see if this resolves the errors?

"dependencies": {
    "@geocodeearth/autocomplete-element": "https://github.com/geocodeearth/autocomplete-element#no-deep-effect"
  },

https://github.com/geocodeearth/autocomplete-element/compare/no-deep-effect?expand=1

Other than that, as you mentioned, using the CDN is a workaround.

gtrusgnich-tempestive commented 7 months ago

I could not get the package to load from the specified repo. It seems to install it correctly, but importing with import import '@geocodeearth/autocomplete-element' gives me error saying I can't find the module. With version 0.7.0 the import works correctly