Search code examples
nullnuxt.jsclient-sideappendchildgithub-third-party-apps

Integrate frontchat with Nuxt


I am integrating the front app with my nuxt site. It's already working fine with my previous vue site. Add the bundle in the script tag of the nuxt.config.js file.

  head: {
   script: [{ src: 'https://chat-assets.frontapp.com/v1/chat.bundle.js' }]
  },

I am integrating the rest of the script in the Pages/index.vue file. Like that

if (process.client) {
  window.FrontChat('init', {
  chatId: 'XXXXXXXXXXXXXXX',
  useDefaultLauncher: true
});
}

Its giving me this warning & error. enter image description here


Solution

  • I resolved it by just adding body: true because the

    Front Chat script should be positioned just before the closing body tag.

    head: {
      script: [{ 
        src: 'https://chat-assets.frontapp.com/v1/chat.bundle.js' 
        body: true, 
      }]
    },