Replies: 4 comments 4 replies
-
I believe I got it working by registring all of the components in a client plugin, doesn't seem like it supports SSR:
|
Beta Was this translation helpful? Give feedback.
-
I ran into the same issue as you, window is not defined :( |
Beta Was this translation helpful? Give feedback.
-
Same issue : Did you find out how to make it work with SSR ? |
Beta Was this translation helpful? Give feedback.
-
I use nuxt 3 SSR together with the Leaflet map. First, make sure you have the vue-leaflet and leaflet installed (use devDependencies). Next, import the required components into the component where you want to use the map and add a CSS file from leaflet:
Then add the map in the template. Remember about client-only :)
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
How much does SSR work? I'm using Nuxt3, and what seems to happen is that the outer div for the map is rendered, but none of the map content is rendered until it loads on the client.
Here's a demo:
https://stackblitz.com/edit/github-ubdbme-weqwmx?file=app.vue
If you load up that in a new window, and then do Ctrl+U to view the source that has been rendered on the server, you can see this:
<div style="width:100%;height:500px;'width:500px;" class="ourmap"></div>
I also see errors when running a nuxt SSR pre-render, with
window is not defined
in leaflet:var requestFn = window.requestAnimationFrame || getPrefixed("RequestAnimationFrame") || timeoutDefer;
(Thanks for working on this, btw)
Beta Was this translation helpful? Give feedback.
All reactions