prashantpalikhe / nuxt-ssr-lit

SSR support for Lit elements in Nuxt3
Other
42 stars 7 forks source link

[WIP] Nuxt 2 support #15

Closed steveworkman closed 1 year ago

steveworkman commented 1 year ago

Fixes #9

So far this is a refactor of the render code to split it for nuxt 2 and nuxt 3

steveworkman commented 1 year ago

ToDo:

steveworkman commented 1 year ago

However, with it in its current state, the nuxt 2 playground runs and builds in SSR mode without crashing and most of the components hydrate correctly. DSD is not added but that will be solved by the above changes

steveworkman commented 1 year ago

Today I replaced the @open-wc/import-meta-loader with one that resolves local file paths rather than just webpack localhost ones. This is fine in dev, but it doesn't build, saying it can't find the module. If I get that to find the module, it complains that source.replace is not a function - seemingly some objects other than strings are being passed through it, and it falls over.

Beyond that, vue-server-renderer for nuxt 2 needs the fs module that it is trying to load client-side, and beyond that, the latest nuxt RC is causing the component that is loaded first to be added as another document fragment, instead of replacing the SSR one, I think due to https://github.com/nuxt/framework/pull/7527 or https://github.com/nuxt/framework/pull/7713.

I'm no longer sure that the current approach of wrapping components will work, and we should look at rendering hooks instead

prashantpalikhe commented 1 year ago

Closing this for now. We can revisit it later if we want to add the Nuxt2 support.

516310460 commented 1 year ago

Help nuxt2