N
Nuxt2y ago
GreyXor

window.alert and nuxt generate ? window is not defined

<script setup>
window.alert('hello');
</script>
<script setup>
window.alert('hello');
</script>
pnpm generate I got this error window is not defined How I can solve this ?
9 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Alejandro Mery
console.log() will work on either side though
GreyXor
GreyXorOP2y ago
Hello thanks, my application will only work in a browser with nuxt generate. So I should put all my code in if (process.client) ?
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
GreyXor
GreyXorOP2y ago
Should I disable SSR or use process.client ? i thought SSR is nice
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
GreyXor
GreyXorOP2y ago
No, it will be a static http classic server (a little gitlab pages)
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
GreyXor
GreyXorOP2y ago
Ah I thought that even in static, the SSR would generate all the pages in a certain way that improved the rendering, or something like that thanks
Want results from more Discord servers?
Add your server