Gatsby static site and Legacy Node/Express backend: Client‑side hydration isolation
0 reputation · 03 Jun 2025, 06:40 UTC
Goal
Ensure that the Gatsby‑generated static site can be served alongside the existing Node/Express backend during a zero‑downtime cut‑over without client‑side hydration causing style leaks or script conflicts from shared global CSS or JavaScript variables.
Constraints: the legacy app continues to load its own global stylesheet and runtime scripts on the same domain; Gatsby’s hydration process must not modify or be overridden by those globals, and the solution must work with Gatsby’s standard build and client‑runtime without requiring a full rewrite of either application.
- What mechanisms does Gatsby provide to scope its injected CSS and JavaScript so they do not interfere with globally scoped legacy assets?
- Are there recommended naming conventions or build‑time configurations (e.g., CSS modules, path‑prefix‑based asset hashing) that guarantee isolation when both apps share the same HTML document?
- How can the isolation be verified automatically in a staging environment before switching traffic?