fix(nuxt): use static import for updateAppConfig in HMR (#28349)

This commit is contained in:
pan93412 2024-08-06 00:19:16 +08:00 committed by GitHub
parent 153ccc2089
commit 2def6d7e00
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -341,9 +341,10 @@ import { defuFn } from 'defu'
const inlineConfig = ${JSON.stringify(nuxt.options.appConfig, null, 2)}
/** client **/
import { updateAppConfig } from '#app/config'
// Vite - webpack is handled directly in #app/config
if (import.meta.dev && !import.meta.nitro && import.meta.hot) {
const { updateAppConfig } = await import('#app/config')
import.meta.hot.accept((newModule) => {
updateAppConfig(newModule.default)
})