Skip to content

Warn "missing required field id" for registry scripts when id is only set via runtimeConfig / NUXT_PUBLIC_SCRIPTS_* #761

@tsukiyama-3

Description

@tsukiyama-3

🐛 The bug

When the pixel / tag id is set only via runtimeConfig.public.scripts and/or NUXT_PUBLIC_SCRIPTS_* (no id in scripts.registry), the dev server can still log:

[nuxt-scripts] registry.<key>: missing required field 'id'. The script infrastructure is registered but will not function without it.

By then runtimeConfig.public.scripts already has id after the module merge, so the warning is wrong and clashes with the documented env / runtimeConfig flow.

Docs: Nuxt Config — Environment Variables

🛠️ To reproduce

https://stackblitz.com/edit/github-gzbuzr-ghdbaa84?file=app%2Fapp.vue,app%2Fpages%2Findex.vue,nuxt.config.ts,package.json

🌈 Expected behavior

No WARN when the effective config (after merging process.env / registryWithDefaults into runtimeConfig.public.scripts) satisfies the schema’s required fields.

If id is truly missing everywhere, the WARN should still appear.

ℹ️ Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions