Skip to content

globals scripts defined at build-time prevent multi-instance deployments with different third-party IDs #759

@agracia-foticos

Description

@agracia-foticos

🆒 Your use case

Problem: Third-party scripts registered via scripts.globals in nuxt.config.ts (e.g. Trusted Shops, Awin, Scrads) have their IDs and src URLs baked into the bundle at build time. It is not possible to change them per server instance without rebuilding.

Use case: Single build, multiple deployments — each instance has different Trusted Shops / Awin / Scrads account IDs set via environment variables.

🆕 The solution you'd like

Expected behavior: Either (a) allow globals entries to reference runtimeConfig values, or (b) provide a composable/plugin API (e.g. useScript() with a src derived from useRuntimeConfig()) that registers global scripts lazily at server request time rather than at build time.

🔍 Alternatives you've considered

Note: The trigger: 'manual' option is already used, so lazy initialization is already part of our setup — the blocker is purely the static src URL with the embedded ID.

ℹ️ Additional info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions