I’m building a nuxt module, and want to set loadingTemplate within this module.
What I tried so far is modifying devServer
inside module like below (But no luck)
import { loadingTemplate } from './loadingTemplate'
export default defineNuxtModule<ModuleOptions>({
...
async setup (options, nuxt) {
nuxt.options.devServer = {
...nuxt.options.devServer,
loadingTemplate
}
}
})
I’ve also tried doing it via hooks
:
import { loadingTemplate } from './loadingTemplate'
export default defineNuxtModule<ModuleOptions>({
...
async setup (options, nuxt) {
nuxt.hook('ready', (nuxtApp) => {
nuxtApp.devServer = {
...nuxt.devServer,
loadingTemplate
}
})
}
})
I’ve tried different hooks: ready
, listen
Can someone point me in correct direction on how to use custom loadingTemplate
that will be set from my nuxt module?