mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 07:05:11 +00:00
fix(nuxt): mark config head as non-reactive (#4666)
This commit is contained in:
parent
773c565fef
commit
2a3fbb4c24
@ -1,5 +1,5 @@
|
||||
import { resolve } from 'pathe'
|
||||
import { addPlugin, addTemplate, defineNuxtModule, isNuxt3 } from '@nuxt/kit'
|
||||
import { addPlugin, addTemplate, defineNuxtModule } from '@nuxt/kit'
|
||||
import defu from 'defu'
|
||||
import { distDir } from '../dirs'
|
||||
import type { MetaObject } from './runtime'
|
||||
@ -31,7 +31,7 @@ export default defineNuxtModule({
|
||||
// Add global meta configuration
|
||||
addTemplate({
|
||||
filename: 'meta.config.mjs',
|
||||
getContents: () => 'export default ' + JSON.stringify({ globalMeta, mixinKey: isNuxt3() ? 'created' : 'setup' })
|
||||
getContents: () => 'export default ' + JSON.stringify({ globalMeta })
|
||||
})
|
||||
|
||||
// Add generic plugin
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { computed, getCurrentInstance } from 'vue'
|
||||
import { computed, getCurrentInstance, markRaw } from 'vue'
|
||||
import * as Components from './components'
|
||||
import { useHead } from './composables'
|
||||
import { defineNuxtPlugin, useNuxtApp } from '#app'
|
||||
@ -11,11 +11,11 @@ declare module 'vue' {
|
||||
}
|
||||
|
||||
const metaMixin = {
|
||||
[metaConfig.mixinKey] () {
|
||||
created () {
|
||||
const instance = getCurrentInstance()
|
||||
if (!instance) { return }
|
||||
|
||||
const options = instance.type || /* nuxt2 */ instance.proxy?.$options
|
||||
const options = instance.type
|
||||
if (!options || !('head' in options)) { return }
|
||||
|
||||
const nuxtApp = useNuxtApp()
|
||||
@ -28,7 +28,7 @@ const metaMixin = {
|
||||
}
|
||||
|
||||
export default defineNuxtPlugin((nuxtApp) => {
|
||||
useHead(metaConfig.globalMeta)
|
||||
useHead(markRaw(metaConfig.globalMeta))
|
||||
|
||||
nuxtApp.vueApp.mixin(metaMixin)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user