Raruto / leaflet-elevation

Leaflet plugin that allows to add elevation profiles using d3js
GNU General Public License v3.0
254 stars 82 forks source link

`import.meta` is undefined within Vue.js application #204

Closed isuke01 closed 2 years ago

isuke01 commented 2 years ago

Subject of the issue

Hi, not really an issue, more like help wanted. I'm trying to import the script into my VUE 3 app. I'm doing import * as elevation from '@raruto/leaflet-elevation';

I'm not even doing any callbacks nor nothing to the element; But it produce the error:

control.js:10 Uncaught TypeError: Cannot read properties of undefined (reading 'split')
    at control.js:10:110

Your environment

Thanks for any hint how to import correctly the script :)

Raruto commented 2 years ago

Hi Lukasz, the offending line should be the following: https://github.com/Raruto/leaflet-elevation/blob/37372a5dcf0a68b9d520b1195a488fbd1f140869/src/control.js#L9-L10

I don't know if there are any support utilities for vue, but take a look at mdn documentation to understand what it is for.

Have a nice day, Raruto

Raruto commented 2 years ago

I close it here because it seems to be simply an issue related to how to use Vite: https://github.com/vitejs/vite/issues/7287#issuecomment-1066054251

If not let me know, Raruto