-
-
Notifications
You must be signed in to change notification settings - Fork 437
window undefined in preload #533
Comments
Code in |
This is my logic:
If I use on-create then the page does not wait for the call to be completed before loading the page? Another point, this issue appears after I open the application on browser so I assumed it happens in browser But worst part is the error appears on node application and i cannot see the file in browser debugger. When and What is the different activity happening in preload when run in server and client? |
https://sapper.svelte.technology/guide#routing states that So in-order to make sure window is available I created a dummy first route and inside the oncreate i re-routed to the main route, so shouldn't main route have window object now? |
@Vishwaas Since This means that This gives you two choices,
Both scenarios will display the page before a redirect happens though. |
I am already doing this |
The design decision was that I think something you could do now though is to create a piece of Express middleware that runs just before Sapper, which grabs |
Closing, as I don't think this is something Sapper should itself provide. |
Change of heart on this one: We're probably going to go ahead with something like #735 which lets you access the page's host in a unified way across server and client in preloads and in the page store.s |
Is window supposed to be undef in _layout.svelte too? |
Xxx______.. |
Hi
When I try to access
window
object when running within preload of the index.html route(basically first route) I get window as undefined.My webpack is as below:
The text was updated successfully, but these errors were encountered: