diff --git a/packages/nuxt/src/core/templates.ts b/packages/nuxt/src/core/templates.ts index ba16996317..380d7d0cbf 100644 --- a/packages/nuxt/src/core/templates.ts +++ b/packages/nuxt/src/core/templates.ts @@ -280,10 +280,18 @@ export const appConfigTemplate: NuxtTemplate = { write: true, getContents: async ({ app, nuxt }) => { return ` +import { updateAppConfig } from '#app' import { defuFn } from '${await _resolveId('defu')}' const inlineConfig = ${JSON.stringify(nuxt.options.appConfig, null, 2)} +// Vite - webpack is handled directly in #app/config +if (import.meta.hot) { + import.meta.hot.accept((newModule) => { + updateAppConfig(newModule.default) + }) +} + ${app.configs.map((id: string, index: number) => `import ${`cfg${index}`} from ${JSON.stringify(id)}`).join('\n')} export default /* #__PURE__ */ defuFn(${app.configs.map((_id: string, index: number) => `cfg${index}`).concat(['inlineConfig']).join(', ')})