Closed davedbase closed 9 months ago
yes, is there a branch somewhere that has this setup with solid-start so i can test it myself?
We have a somewhat-working branch here: https://github.com/solidjs/solid-site/tree/solid-start-migration/src however admittedly I have a bit more work to do on it to get it operational again. Your best bet after that is setup a basic version of solid-start and give it a spin. Using the solid-site implementation might post more headaches.
My suggestion is perhaps you can release a version that has document protected under isServer. As long as that happens I should be able to test it for you on my end.
Yeah that was my plan but it seems like the document comes from a dependency, I don't use it in the lib :/. Weird that no one has raised the same issue in react-markdown, since the code is 80% ported from there.
They're likely not doing SSR? It's a very specific use case. Even then I think some platforms have SSR friendly fallbacks. I'm not totally sure tbh, just a guess
is the expected outcome here that SSR is working with markdown, or just that it doesn't throw an error
Well as long as the library returns a proper node tree then SSR should work fine. I just skimmed what you have implemented and does seem to do that. The goal is indeed to ensure our SSR processor doesn't trip on document (because obviously it's not defined in a Node environment).
Question: is document getting called?
I see it in the output of the bundled library but not in the source code, so I'm in the process of investigating the dependencies to see which one uses it.
No idea where it's coming from, might actually be from Solid. Will do a proper investigation tomorrow when I have time to reproduce it locally with solid-start
Any update on this? You can I think use this function from solid-primitives to make it work.
https://github.com/solidjs-community/solid-primitives/blob/main/packages/utils/src/index.ts#L27
I have created a pull request fixing this issue here: #8 :grin:
ClientOnly
fyi everyone, did a refactor of solid-markdown recently, which resulted in v2.0.0
being published on npm
there's now a ssr-demo
folder in the repo to ensure the library still works in an ssr context and there's no regressions
@andi23rosca I was going through the process of adapting solid-site to solid-start and noticed that solid-markdown was tripping on a document reference:
Could we get this wrapped in an isServer check? :-)