nuxt-modules / device

Nuxt module for detecting device type.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Property "$device" was accessed during render but is not defined on instance.

bigyonk opened this issue · comments

Migrating from Nuxt2 to Nuxt3 and receiving the following errors:

[Vue warn]: Property "$device" was accessed during render but is not defined on instance.           
[nitro] [dev] [unhandledRejection] TypeError: Cannot read properties of undefined (reading 'isMobileOrTablet')

component:

  <section class="section-gallery">
    <div class="container">
      <TouchGallery v-if="$device.isMobileOrTablet" />
      <DesktopGallery v-else />
    </div>
  </section>
</template>

<script>
import TouchGallery from './TouchGallery.vue'
import DesktopGallery from './DesktopGallery.vue'

export default {
  components: { TouchGallery, DesktopGallery },
}
</script>

Any ideas on what might be going on here?

This turned out to be an issue with nuxt.config.ts