diff --git a/src/module.ts b/src/module.ts index 9a7755ea..b3c8fd23 100644 --- a/src/module.ts +++ b/src/module.ts @@ -159,6 +159,36 @@ function fixSelfClosingScriptComponents(nuxt: any) { } } +const REGISTRY_ENV_DEFAULTS: Record> = { + clarity: { id: '' }, + cloudflareWebAnalytics: { token: '' }, + crisp: { id: '' }, + databuddyAnalytics: { clientId: '' }, + fathomAnalytics: { site: '' }, + googleAdsense: { client: '' }, + googleAnalytics: { id: '' }, + googleMaps: { apiKey: '' }, + googleRecaptcha: { siteKey: '' }, + googleSignIn: { clientId: '' }, + googleTagManager: { id: '' }, + hotjar: { id: '' }, + intercom: { app_id: '' }, + matomoAnalytics: { matomoUrl: '' }, + metaPixel: { id: '' }, + paypal: { clientId: '' }, + plausibleAnalytics: { domain: '' }, + posthog: { apiKey: '' }, + redditPixel: { id: '' }, + rybbitAnalytics: { siteId: '' }, + segment: { writeKey: '' }, + snapchatPixel: { id: '' }, + stripe: {}, + tiktokPixel: { id: '' }, + umamiAnalytics: { websiteId: '' }, + vercelAnalytics: {}, + xPixel: { id: '' }, +} + const PARTYTOWN_FORWARDS: Record = { googleAnalytics: ['dataLayer.push', 'gtag'], plausible: ['plausible'], @@ -355,12 +385,35 @@ export default defineNuxtModule({ // Merge registry config with existing runtimeConfig.public.scripts for proper env var resolution // Both scripts.registry and runtimeConfig.public.scripts should be supported if (config.registry) { - // Ensure runtimeConfig.public exists nuxt.options.runtimeConfig.public = nuxt.options.runtimeConfig.public || {} + // Auto-populate env var defaults for enabled registry scripts so that + // NUXT_PUBLIC_SCRIPTS_