mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-13 12:18:15 +00:00
fix(nuxt): delete existing properties in app config HMR (#30918)
This commit is contained in:
parent
763450c93d
commit
fc52ff8c08
@ -54,6 +54,13 @@ export function useAppConfig (): AppConfig {
|
||||
return nuxtApp._appConfig
|
||||
}
|
||||
|
||||
export function _replaceAppConfig (newConfig: AppConfig) {
|
||||
const appConfig = useAppConfig()
|
||||
|
||||
deepAssign(appConfig, newConfig)
|
||||
deepDelete(appConfig, newConfig)
|
||||
}
|
||||
|
||||
/**
|
||||
* Deep assign the current appConfig with the new one.
|
||||
*
|
||||
|
@ -437,12 +437,12 @@ import { defuFn } from 'defu'
|
||||
const inlineConfig = ${JSON.stringify(nuxt.options.appConfig, null, 2)}
|
||||
|
||||
/** client **/
|
||||
import { updateAppConfig } from '#app/config'
|
||||
import { _replaceAppConfig } from '#app/config'
|
||||
|
||||
// Vite - webpack is handled directly in #app/config
|
||||
if (import.meta.dev && !import.meta.nitro && import.meta.hot) {
|
||||
import.meta.hot.accept((newModule) => {
|
||||
updateAppConfig(newModule.default)
|
||||
_replaceAppConfig(newModule.default)
|
||||
})
|
||||
}
|
||||
/** client-end **/
|
||||
|
Loading…
Reference in New Issue
Block a user