nuxt-modules / device

Nuxt module for detecting device type.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Running on Nuxt.js head using this.$device.isDesktop

dyarfi opened this issue · comments

Hi, this is a great module, I try to use and test this on the Nuxt.js head using this.$device.isDesktop:

head() {
   const { $device } = this
   return {
      title: 'page title',
      ...($device.isDesktop && {
        script: [
          {
            innerHTML: 'structuredData',
            type: 'application/ld+json'
          }
        ]
      })
   }
}

The module only working on yarn dev not on build or generate even on yarn start. Am I missing something? well, my actual target was $device.isCrawler to load scripts only on bots engine (Not yet tested on live).

Tested on:
"nuxt": "^2.14.12"
"@nuxtjs/device": "^2.1.0"

Thank you