davidroyer / nuxt2-ssr-firebase

Nuxt2 Universal App with SSR via Firebase Functions and Firebase Hosting
https://nuxt2ssrfire.firebaseapp.com
50 stars 11 forks source link

Server and Client DOM Mismatch #1

Closed infostatus closed 6 years ago

infostatus commented 6 years ago

I'm trying to add Element-UI to the project. It renders in server but not the client side. On page refresh it will show from the server correctly rendered but when client version comes in, it gives the error and looses the style.

I've followed all steps saw in other projects:

I've cloned the project with this changes here: https://github.com/infostatus/nuxt2-ssr-firebase-elementui

These are other projects where Nuxt and Element-ui work perfectly:

What is missing? Been around this for some days now, trying all different things. Much appreciated for any help I can get.

Thank you so much for this helpful repository.

infostatus commented 6 years ago

UPDATE: The problem is something related to the Nuxt Plugins. I've added Bootstrap-vue as a Module in nuxt.config.js and everything worked as expected.

But when adding i18n as a plugin, it happens like ElementUI. The page is rendered in the server but not on the client side.

David Royer, be most grateful if you please help out

infostatus commented 6 years ago

Here's an example of the problem: https://paying-forward.firebaseapp.com/fr/about

For a split second it shows the server version correctly. But then it falls to the client version that has no access to the plugin.

What is missing?

infostatus commented 6 years ago

After more testing It happens with any plugin, it is rendered in the server but not on the client.

I've created a repository with a plugin for the Logo component.

Here's the source code: https://github.com/infostatus/nuxt2-ssr-firebase-plugins-issue

Clone, then run "yarn setup" and "yarn dev". The logo will show for a split second before error for not finding the component.

infostatus commented 6 years ago

Finally solved the problem. The nuxt folder is not being copied correctly: "copydist": "cp -R prod/server/nuxt/dist/ prod/client/assets"