Switching between SSR and Client Side Rendering


I’d like to implement Server Side Rendering in my app (and have it set up and working) but since the entire server restarts every time I change a UI file, I need to stick with Client Side Rendering most of the time and only switch to SSR for testing and building the app. Unfortunately, I’m struggling to find a good way to accomplish this.
Things I’ve tried so far:

  • Creatied a ui folder, used .meteorignore to avoid processing the files, and then symlinked the folder to client/ui and server/ui. When SSR is disabled, I’d remove the server/ui symlink. Unfortunately, meteor is aware of the symlink and won’t process the files.
  • Created a ui/client folder, used a script to rename the directory to ui/shared when SSR is enabled, and set up Babel path mapping so ui/ refers to either ui/client or ui/shared depending on whether or not SSR is enabled. Unfortunately this runs into issues with stylesheets, which aren’t able to handle the path mapping.

If only there was a separate .meteorignore.server for server-side files…

How do you handle SSR?