Open matthewp opened 8 years ago
Deferring this for now, it's harder than it sounds. Currently canjs maps can/util/vdom/vdom to load on the server, so we'd want to disable that somehow when using an alternative implementation.
This should be possible now with can 3.0. We no longer shim any libraries.
Just a matter of picking an API now. We need to be able to receive a window
object that is distinct for each request. So if the user provides their own DOM implementation a function makes most sense. My first thought is:
const ssr = require("done-ssr");
const { JSDOM } = require("jsdom");
function makeDom() {
var dom = new JSDOM();
return dom.window;
}
const render = ssr({}, {
dom: makeDom
});
cc @justinbmeyer what do you think about the above API?
Currently we rely on
can/util/vdom/vdom
but it would be nice if it could work with jsdom since that is more robust.