More options to indicate public environment variable then simple publicPrefix

#12375

Development PR

Issue

Feature
Closed at Sep 3, 2026, 2:43 AM
X
xmlking
Jun 20, 2024, 3:45 AM

Describe the problem

i like sveltekit support array for publicPrefix config. I have to deal with a vendor lib that expect public environment variables prefixed with NHOST_* and rest used PUBLIC_* . With current limitation, I have to define duplicate variables

my usecase : https://github.com/xmlking/spectacular/blob/916ef57220c6ef451dc9317e26201bb75a1641c3/.env.example#L42****

Describe the proposed solution

While using some 3rd party service provides ( CMS, Backend-as-a-Service, payment systems) with SvelteKit, we have to use vender provided libraries to interact with their system, sometime they have some Convention-over-configuration to use environment variables that are prefixed with certain text (e.g., NHOST_, VERCEL_ etc) . If those environment variables are needed on both client-side as well as server-side, we have to duplicate them once with vendor prefix and PUBLIC_which leads to duplication. It will be nice to allow multiple patterns/prefixes to indicate public variables in SvelteKit to support such use-cases.

Alternatives considered

Inspired from Astro astro:env , methodology described here seams more flexible

Importance

nice to have

Additional Information

Ref

👍 4