on a window.setInterval function set on my index.svelte I get "Window is not defined 500 error but the application continues loading successfully
Just in case this is found by anybody in future - the reason for this is that setInterval which is only available in the browser, was running on the server (node) (it needs to be part of onMount to isolate it to the browser only.
The reason the application continued loading is that the call to setInterval would break SSR, and therefore cause the server rendering to fail, but the client JS would continue to load in the browser (since window is defined there), masking the server-side failure.
Most helpful comment
Just in case this is found by anybody in future - the reason for this is that
setIntervalwhich is only available in the browser, was running on the server (node) (it needs to be part ofonMountto isolate it to the browser only.The reason the application continued loading is that the call to setInterval would break SSR, and therefore cause the server rendering to fail, but the client JS would continue to load in the browser (since window is defined there), masking the server-side failure.