preact-markup icon indicating copy to clipboard operation
preact-markup copied to clipboard

Add SSR Support

Open Saeris opened this issue 5 years ago • 2 comments

Added jsdom as a dependency.

In parser-markup.js, document is accessed to create a frame to render HTML in. Since document doesn't exist in Node, this causes SSR builds to throw a reference error. With this change, we check for the existence of document and polyfill it using jsdom if it doesn't exist.

Saeris avatar Apr 03 '20 21:04 Saeris

This is going to inline jsdom in all bundlers.

I think we'll need to provide a separate entry module for web/node in order to do the polyfilling.

developit avatar Apr 03 '20 21:04 developit

There are several PR proposals (plus one that was closed without resolution), so I wrote a quick heads-up: https://github.com/developit/preact-markup/issues/6#issuecomment-809934523 (Preact WMR uses JSDOM in its Mardown render code)

danielweck avatar Mar 30 '21 06:03 danielweck