Skip to content

Drop need to specify the runtime config when using .env #239

Open
@harlan-zw

Description

@harlan-zw

🆒 Your use case

I beleive this is a Nuxt edge case for .env, but end user needs to specify an empty key for the .env override to do anything, i.e:

export default defineNuxtConfig({
  scripts: {
    registry: {
      googleAnalytics: true,
    }
  },
  // you need to provide a runtime config to access the environment variables
  runtimeConfig: {
    public: {
      scripts: {
        googleAnalytics: {
          // .env
          // NUXT_PUBLIC_SCRIPTS_GOOGLE_ANALYTICS_ID=<your-id>
          id: '',
        },
      },
    },
  },
})

🆕 The solution you'd like

We should try and see if we can drop the need for this runtimeConfig as it's quite verbose.

🔍 Alternatives you've considered

No response

ℹ️ 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