Gatsby's static site generation requires specific patterns for Lottie â animations need to be excluded from SSR, JSON imports need proper webpack config, and performance needs special attention for static pages. This guide covers all of it.
The Core SSR Problem
Gatsby generates HTML at build time. Lottie animations reference window, document, and navigator â cone of which exist during server-side rendering. If you import Lottie without precautions, builds fail with:
WebpackError: ReferenceError: window is not defined
Enter fullscreen mode






