ruigomeseu / vue-turnstile

A Cloudflare Turnstile library for Vue 3
MIT License
63 stars 9 forks source link

Vue-turnstile not compatible with SSR #7

Closed miguilimzero closed 1 year ago

miguilimzero commented 1 year ago

The package is currently not allowing SSR apps to be compiled. This is happening due to the SSR trying to compile the VueTurnstile component following line:

let turnstileState = window.turnstile !== undefined ? 'ready' : 'unloaded';

SSR applications cannot access the window object.

image

miguilimzero commented 1 year ago

This is happening because the window is being accessed outside the Vue.js defineComponent and the SSR is trying to compile the window object into something, however window cannot be accessed using SSR.