NuxtN
Nuxt13mo ago
bnason

Cannot access before initialization

I have a few custom nitro aliases setup:
nuxt.hook('nitro:config', (nitroConfig) => {
    if (!nitroConfig.alias) return

    nitroConfig.alias['#queue-handlers'] = resolve('./runtime/server/handlers')
    nitroConfig.alias['#queue'] = resoleServer('./queues')
    nitroConfig.alias['#cron'] = resolve('./runtime/server/queues/cron')
})


My cron source file imports import { defineQueue } from '#queue-handlers' but this is giving me the following error: ERROR [nitro] [uncaughtException] Cannot access 'defineQueue' before initialization

It seems like some sort of registration timing or order but I can't see what.
Was this page helpful?