Skip to content

ScriptYouTubePlayer self-closing tag affects definePageMeta #613

@kotering

Description

@kotering

Reproduction repository: https://github.com/kotering/script-youtube-player-issue-repro

ScriptYouTubePlayer self-closing tag affects definePageMeta

Summary

  • In a Nuxt page component, using <ScriptYouTubePlayer ... /> can cause definePageMeta to behave as if not applied.
  • Changing only the markup to <ScriptYouTubePlayer ...></ScriptYouTubePlayer> restores normal behavior.
  • The same page script is unchanged.

Environment

  • Nuxt: 4.3.1
  • Vue: 3.5.28
  • @nuxt/scripts: 0.13.2
  • Reproduced in local nuxt dev.

Reproduction (in this repository)

  1. Start dev server.
  2. Open:
    • /self-closing (self-closing tag)
    • /expanded (expanded tag)
  3. Compare behavior of definePageMeta (layout: 'dark', props: { color: 'red' }).

Repro components

  • Self-closing:
    • app/pages/self-closing.vue
  • Expanded:
    • app/pages/expanded.vue

Expected

  • Both syntaxes should be equivalent in Vue SFC templates.
  • definePageMeta should apply identically.

Actual

  • Self-closing syntax may result in page meta/layout behavior differences.
  • Expanded syntax works as expected.

Hypothesis

  • With <ScriptYouTubePlayer ... />, definePageMeta seems to be dropped during route generation for that page.
  • In generated routes, the expanded version includes route meta/props, while the self-closing version does not.
  • This suggests a compile/transform issue around @nuxt/scripts + self-closing syntax, rather than runtime navigation differences.

Notes

  • LazyScriptYouTubePlayer appears less likely to reproduce this specific behavior in the same environment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions