Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

refactor(nuxt): deprecate <Script> component tag in template #8197

Merged
merged 2 commits into from Oct 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions packages/nuxt/src/head/runtime/components.ts
Expand Up @@ -66,6 +66,10 @@ const globalProps = {
}

// <script>

let scriptDeprecated = false

/** @deprecated */
export const Script = defineComponent({
// eslint-disable-next-line vue/no-reserved-component-names
name: 'Script',
Expand Down Expand Up @@ -93,6 +97,11 @@ export const Script = defineComponent({
renderPriority: [String, Number]
},
setup: setupForUseMeta((props, { slots }) => {
if (process.dev && !scriptDeprecated) {
console.log('[nuxt] `<Script>` is deprecated and may be removed in a future release. We advise using `useHead()` directly.')
scriptDeprecated = true
}

const script = { ...props }
const textContent = (slots.default?.() || [])
.filter(({ children }) => children)
Expand Down