Skip to content

Disable warning on missing key #427

@IlyaSemenov

Description

@IlyaSemenov

🆒 Your use case

When I build the project, I don't know beforehand if it's going to have active Turnstile integration or not. I run it in multiple environments; in production and pre-prod I provide the runtime key (which is different between the two), and in staging and e2e testing environments I don't. The respective front-end code checks for the presence of the key and doesn't inject the <nuxt-turnstile> component unless the key is present.

Currently, the module always prints a warning on build:

WARN  No site key was provided. Make sure you pass one at runtime by setting NUXT_PUBLIC_TURNSTILE_SITE_KEY.

I don't like that warning. My project is supposed to work perfectly fine without the runtime key, it's not correct and misleading that it demands to "make sure" to pass one. I would like to have a way to silence the warning.

🆕 The solution you'd like

I see two solutions.

  1. Emit the warning at runtime (not at build time), when <nuxt-turnstile> component is instantiated without the key.

  2. Add nuxtConfig.turnstile.silenceBuildWarning or something along the lines.

🔍 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