-
-
Notifications
You must be signed in to change notification settings - Fork 327
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
support for builds with server-side rendering #78
Comments
Note: if if (typeof window !== 'undefined') {
confetti();
} Using it in hooks or elsewhere in the lifecycle that is not triggered by SSR will work just fine without any extra checks. |
adding support for server-side rendering
Published in 0.5.0 |
Thanks for building this @catdad! I think the kids in my coding tournaments are going to love this celebration of their achievements! I'm having a little trouble with SSR. Using 1.3.2 and trying gatsby build, I get:
My code is wrapped as suggested (which I also feel should work)
But it seems to be failing on the import (even when I comment out the lines, it fails). I'm wondering if that's because the function is immediately invoked?
Any recommendations? |
allowing ssr to work for es module as well
This was definitely my fault. Thanks for catching this issue! I just published 1.3.3 that should work now (it worked for me in the gatsby starter app). |
I think that did it! It built! Thank you! |
Updating from |
When using SSR (for example, with something like Razzle),
window
cannot be assumed as an existing global, because it does not exist at the time of the build (the code has to be evaluated on the server), so such uses need to reserved for function execution.The text was updated successfully, but these errors were encountered: