Currently there is no nice way how to use async data inside nuxt.config.js.
For example getting some module configuration from remote server, getting head data, list of plugins that need to be enabled for current build etc.
This would allow to use same Nuxt app for multiple similar sites but with slight difference of configuration that is changeable from remote admin panel.
Something like this (quite pseudocode)
// nuxt.config.js
const getHeadConfig = async () => {
let { data } = await axios.get('/my/head/config/url')
return {
...data,
title: 'hurrdurr'
}
}
module.exports = {
mode: 'universal',
// Get conf from remote with axios
loading: axios.get('/my/loading/config/url'),
// Use some method to get data from remote
head: getHeadConfig()
}
I think this problem could be tackled as we do it with modules, plugin etc.
If the export of nuxt.config.js is a function, we should call and await it. 馃
export default async () => {
const data = await otherFn()
return {
head: "...",
...data
}
}
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
I think this problem could be tackled as we do it with modules, plugin etc.
If the export of
nuxt.config.jsis afunction, we should call andawaitit. 馃