-
Notifications
You must be signed in to change notification settings - Fork 36
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
fix: leafleat module import error in ssr mode #474
fix: leafleat module import error in ssr mode #474
Conversation
👷 Deploy request for ephemeral-sable-89c7e0 pending review.Visit the deploys page to approve it
|
It worked in "http://localhost:3000/2024/zh-hant/venue" on my laptop(with node v16.20.2): However it didn't work on landing page: Maybe 2024 landing image wasn't updated? Have you tried git rebase with main branch? |
May I ask which commit had updated the image? I'll check later to fix this. |
Here you are! Check these two: |
hmm....I've check that these commits are in this PR as well, that's weird, |
65c2cbe
to
20baac0
Compare
Hi @SivanYeh, I've rebase the code and follow the steps that Matt tested, |
@@ -163,7 +163,7 @@ export default { | |||
}, | |||
fetchOnServer: false, | |||
computed: { | |||
...mapState(['sponsorsData']), | |||
// ...mapState(['sponsorsData']), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @mattwang44, I've comment out this line and L121, whiche can fix the error.
That error you'd mentioned is based on the setup for archive,
I think it will works the same when we use asyncData
in the file
mounted() { | ||
this.getLeaflet() | ||
}, | ||
methods: { | ||
centerMap() { | ||
this.$nextTick(() => { | ||
this.$refs.leafletMap.mapObject.panTo([25.040997, 121.611417]) | ||
}) | ||
}, | ||
async getLeaflet() { | ||
this.L = await import('leaflet') | ||
this.icon = this.L.icon({ | ||
iconUrl: '/snake.png', | ||
shadowUrl: '/snake-bg.png', | ||
iconSize: [42, 42], | ||
iconAnchor: [21, 21], | ||
shadowSize: [45, 55], | ||
shadowAnchor: [25, 30], | ||
}) | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks to @baby230211 suggestion, the code works well.
It worked perfectly here too! You nailed it Leon. I opened two terminals and followed the steps outlined below:
Terminal2:
Interesting stuff, not vital at the moment but we may have to keep in mind:
These errors can be solved by using node v16. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks @rockleona
|
@baby230211 , I just removed them, have a look if youre free. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
LGTM |
Types of changes
Description
nuxt-leaflet
plugins/leaflet.js
innuxt.config.js
vue2-leaflet
components incomponents/venue/VenueMap.vue
window is not defined
errorSteps to Test This Pull Request
using node v16.x
Steps to reproduce the behavior:
npm install --legacy-peer-deps
npm run dev
http://localhost:3000/2024/zh-hant/venue
Related Issue
resolve #471