support for builds with server-side rendering
See original GitHub issueWhen 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.
/mnt/d/Git/test/confetti-razzle/node_modules/canvas-confetti/src/confetti.js:370
}());
^
ReferenceError: window is not defined
at /mnt/d/Git/test/confetti-razzle/node_modules/canvas-confetti/src/confetti.js:4:5
at /mnt/d/Git/test/confetti-razzle/node_modules/canvas-confetti/src/confetti.js:31:4
at Object.<anonymous> (/mnt/d/Git/test/confetti-razzle/node_modules/canvas-confetti/src/confetti.js:370:2)
at Module._compile (internal/modules/cjs/loader.js:956:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
at Module.load (internal/modules/cjs/loader.js:812:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Module.require (internal/modules/cjs/loader.js:849:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.canvas-confetti (/mnt/d/Git/test/confetti-razzle/external "canvas-confetti":1:1)
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Supporting Server Side Rendering - Stylable
Supporting Server Side Rendering ... Server side rendering (SSR) is an approach to serving JavaScript rendered web applications (such as React, Vue, Angular,...
Read more >Demystifying Server Side Rendering: Let's build our own SSR ...
In this article, I'm going to show you how you can write an SSR framework that allows for static site generation and dynamic...
Read more >Server-Side Rendering - Vite
Vite provides built-in support for server-side rendering (SSR). The Vite playground contains example SSR setups for Vue 3 and React, which can be...
Read more >A hands-on guide for a Server-Side Rendering React app
A hands-on guide for a Server-Side Rendering React app · Terminologies · Create React App and CSR · Deploy the Production Build With...
Read more >Why Should You Build a Server-Side Rendered React App?
Server -side rendering is worth the effort, as it can significantly improve your application's performance, SEO-friendliness, and traffic.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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).
Updating from
0.0.3
to1.4.0
fixed this for me 😆. Thank you!