WebReflection / uhtml

A micro HTML/SVG render

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incompatible with NextJs

abdolian opened this issue · comments

I've created a custom element based on Uhtml and imported it into the NextJs app. I faced with this error:

image

Do you have any plans for SSR support? I need it urgently.

You mean ... uhtml-ssr 🤔

SSR is different, try this on a NextJs App:

import type { NextPage } from 'next';
import { render } from 'uhtml';

const Home: NextPage = () => {
  console.log(render)
  return null
};

export default Home;

You'll receive an error that is related to DOM

@abdolian uhtml uses the DOM to create templates and elements, I've no idea how you expect it to work without a document in it so ... if it's SSR you are after, there is uhtml-ssr.

If NextJs has a document hidden behind a fake global self or window then I might pass through that, although this is not a bug of this library, this is how the DOM works.