choojs / bankai

:station: - friendly web compiler
Apache License 2.0
1.09k stars 102 forks source link

🙋Use Custom HTML Body for Server Side Rendering for non-Choo apps #521

Open seanstrom opened 5 years ago

seanstrom commented 5 years ago

Expected Behavior

When bundling an application that is not written with Choo, and using a custom HTML template, the server side rendering should return HTML that includes the <body> tag contents from the custom HTML template. This would be useful for preserving mount points for apps that are not written with Choo.

Current Behavior

When bundling an application that is not written with Choo, and using a custom HTML template, the server side rendering returns HTML with an empty <body> tag. This means that app mount points declared in the custom HTML template will not be present.

Possible Solution

We could avoid replacing the contents of the body tag if server side rendering is not supported for a given app type. This change could be implemented by specifying extra information for non-choo apps, and conditionally replacing the contents of the html body based on whether the app had SSR contents.

Context

I ran into this functionality when setting up an app that wasn't based on Choo and running the development server. My application would bundle well, but the application could not find the app mount point because it had been removed. This is currently blocking me from continuing to use bankai on some projects.