Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash while running in dev mode in Vite #339

Open
dumbasPL opened this issue Aug 4, 2023 · 3 comments
Open

Crash while running in dev mode in Vite #339

dumbasPL opened this issue Aug 4, 2023 · 3 comments

Comments

@dumbasPL
Copy link

dumbasPL commented Aug 4, 2023

steps to reproduce

  1. create an empty vue with javascript project with vite yarn create vite
  2. install this package and the leaflet package
  3. replace App.vue with:
<script setup>
import "leaflet/dist/leaflet.css";
import { LMap } from "@vue-leaflet/vue-leaflet";
import { ref } from "vue";

const zoom = ref(1);
</script>

<template>
  <div style="height:600px; width:800px">
    <l-map ref="map" v-model:zoom="zoom" :center="[0, 0]">
    </l-map>
  </div>
</template>
  1. run the dev server with yarn dev
  2. do to the website and observe the error: TypeError: Cannot read properties of undefined (reading 'Default')

If you build for production using (yarn build && cd dist && npx serve) then the map works correctly.

This problem seems to be nix* related because it seems to work fine when running on Windows.

error screenshot

image

Versions

os: Arch Linux, also tested and not working on Ubuntu
node: 18.16.0
vue: 3.3.4
vite: 4.4.5
leaflet: 1.9.4
vue-leaflet: 0.10.1
@dumbasPL
Copy link
Author

dumbasPL commented Aug 4, 2023

OK, I've now noticed the posts about :useGlobalLeaflet="false". And yes, that does fix the issue but still doesn't explain why It works on Windows but not Linux. Also, is there anything blocking us from fixing the underlying problem instead of pretending it doesn't exist?

@nsrosenqvist
Copy link

OK, I've now noticed the posts about :useGlobalLeaflet="false". And yes, that does fix the issue but still doesn't explain why It works on Windows but not Linux. Also, is there anything blocking us from fixing the underlying problem instead of pretending it doesn't exist?

I experienced a similar issue on macOS, "e is undefined", I could work around it by using :useGlobalLeaflet="false", thanks for including that information!

@dschmide
Copy link

This should be a top issue or not just mentioned in the SSR section

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants