Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

455
Vistas
nuxtjs/composition-api - Module is undefined on composable file

I'm using @nuxtjs/composition-api in my Nuxt application with Vuetify. I have a composable file like this:

// composables/dialog.js
// https://www.npmjs.com/package/vuetify-dialog
import { useContext } from '@nuxtjs/composition-api'

export function useDialog () {
  const { $dialog } = useContext() // for some reason $dialog is undefined here
  const { message, error, info, warning, notify } = $dialog

  function showInfo (title, text) {
    return info({ title, text })
  }

  function messageSuccess (text) {
    return message.success(text)
  }

  // ... some other functions with message, error, info, warning

  return {
    $dialog,
    showInfo,
    messageSuccess,
    // ...
  }
}

The module $dialog is correctly registered in nuxt.config.js: $dialog docs

{
  modules: [
    // Simple usage
    'vuetify-dialog/nuxt',
    // ... other modules
  ]
}

When I access first a page that doesn't use this composable and then navigate to another page that uses the composable, it works fine. However, if I directly open the page that uses the composable, it shows the error cannot destructure property 'message' of '$dialog' as it is undefined. It happens in production and local env.

import { useDialog } from '~/composables/dialog'

const { showInfo, messageSuccess } = useDialog()

Is there any limitation with composable files and @nuxtjs/composition-api ?

Github Issue

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda