Closed lukejacksonn closed 3 years ago
This seems to work pretty nicely for me.. I wonder, is this sufficient for general SSR now?
That's a good question. I've worked against my forked version and apart from the issues I opened (separate from SSR), it simply works. 😎
Awesome! Thanks for the review. I feel this should also just work™️ but it would be great if you could confirm. I will address your other comments now.
Awesome! Thanks for the review. I feel this should also just work™️ but it would be great if you could confirm. I will address your other comments now.
There's one thing you could add now that I think of it. See https://github.com/bebraw/oceanwind/blob/personal/util/otion.mjs#L71 . That's a fix against Deno for Otion. Otherwise SSR won't work through Deno.
The issue is that Deno exposes window
and I recall their original check used the window
object to tell if it's run in a browser or not. That needs an extra check in Deno environment. It should also avoid the process.env
problem if done right.
Ok I have copied over the contents of the file you linked to into this branch. When I tried running it in the browser I got the process is undefined
error. So I updated the checks to look like this:
const isDeno = typeof window !== 'undefined' && window.Deno;
const isBrowser = isDeno ? false : typeof window !== 'undefined';
const isDev = isDeno || isBrowser ? false : process.env.NODE_ENV !== 'production';
Note the new isDeno || isBrowser
check. Does that make sense to you?
@lukejacksonn Yeah, that isDeno || isBrowser
bit makes sense.
The three lines is starting to feel like some utility to test and extract but there's no need to do that now.
We should try to get this code upstream at some point. 😄
Yeh I agree. Will have to ask @kripod to take a look and see what he thinks!
I think this is good to go now. Might merge then publish!
Ok, got there in the end! Thanks for all your help @bebraw and @jovidecroock 🙇
I will take a look at the other issues now, starting with #10 so that you can start linking from here rather than a fork.
Great job, looks good to me! Thank you for asking me to take a look 😊
Awesome, thanks a lot. 👍
This is an extension of #7 where most of the work was done by @bebraw 🙇 some things that I took the liberty of changing from that branch included:
.mjs
extensions and instead using{ "type": "module" }
in the package json.otion/server
)What still remains is:
setup
andhydrate
functionsThis seems to work pretty nicely for me.. I wonder, is this sufficient for general SSR now?