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

278
Vistas
How to reference an external function in nuxt.config?

So basically I'm setting up an app using nuxt, and within the configuration's generate property I need to run a recursive function to build the sites route tree dynamically. The function is rather large so I dont want it to be in the config file itself

Ive tried doing it this way, but think Im way off

import {buildChildRoutes} from 'routeGenerator'

export default {
  generate: {
    routes(){
      var response = await this.$deliveryClient
      .itemsFeedAll()                  
      .toPromise();

      return buildChildRoutes(response)
    })

has anyone done something like this before? i would assume its common and im just missing something in the documentation

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Here's the solution I used that works

This is my code in nuxt.config.js

import getRoutes from './utils/route-generator.js'

const dynamicRoutes = () => {
  return new Promise((resolve) => {
    resolve(getRoutes())
  })
}

export default {
  generate: {
    routes: dynamicRoutes
  }
}
over 4 years ago · Santiago Trujillo Denunciar
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