DEV Community

Discussion on: Build Mobile Apps with Tailwind CSS, Next.js, Ionic Framework, and Capacitor

Collapse
 
erikmellum profile image
Erik Mellum • Edited

What are the limitations to adding SSR? I love the stack here, basically everything I want, but I want to include SSR. My understanding is that Ionic has references to window object that do not work in node. I've had this limitation in past projects and used JSDOM to spoof the window. Something like this:

//set up a dom for us to work with on the node backend
dom = new JSDOM('<!DOCTYPE html>', {
userAgent: "webkit",
});
//use jsdom to mimic some aspects of a web browser here in our node process
global.window = dom.window;
global.navigator = global.window.navigator;
global.document = global.window.document;

I'm likely to try this myself over the next day or two, but wondering if you have any words of wisdom or suggestions. I'm not certain until I try if the window object is the present limitation. Just throwing out some ideas.

Collapse
 
thewizardofwikacy profile image
The Wizard of Wikacy

very interested to know if you tried this. i am working on this now

Collapse
 
renatovanquish profile image
Renato T. Carvalho Jr.

Dear, Any suggestions for use with SSR?