<client-only> component is not working in Vue Server-side rendering using vue-server-renderer

673 views Asked by At

ClientOnly component imported from vue-client-only module from npm is not working in server-side rendering with vue-server-renderer. I have added firebaseui component inside the client-only tags. I have also tried the older no-ssr component, but that also did not work. In the browseer it only shows null html comments in place of these components. Please help.

<template>
  <v-container fluid>
    <h3>Sign Up Page</h3>
    <client-only>
      <h2>Client Only Component</h2>
      <div id="firebaseui-auth-container"></div>
    </client-only>
  </v-container>
</template>



<script>
import firebase from "firebase/app";
import ClientOnly from "vue-client-only";

if (process.browser || process.client) {
  import("firebaseui").then(module => {
    const firebaseui = module;

    const ui = new firebaseui.auth.AuthUI(firebase.auth());

    ui.start("#firebaseui-auth-container", {
      signInOptions: [
        {
          provider: firebase.auth.GoogleAuthProvider.PROVIDER_ID
        }
      ],
      signInSuccessUrl: "/"
    });
  });
}

export default {
  name: "Authentication",
  components: {
    ClientOnly
  },
  mounted() {}
};
</script>

In the browser :

null html comments instead of firebase ui element

0

There are 0 answers