({
envPrefix = 'VITE_',
}: UserConfig)
| 107 | } |
| 108 | |
| 109 | export function resolveEnvPrefix({ |
| 110 | envPrefix = 'VITE_', |
| 111 | }: UserConfig): string[] { |
| 112 | envPrefix = arraify(envPrefix) |
| 113 | if (envPrefix.includes('')) { |
| 114 | throw new Error( |
| 115 | `envPrefix option contains value '', which could lead unexpected exposure of sensitive information.`, |
| 116 | ) |
| 117 | } |
| 118 | if (envPrefix.some((prefix) => /\s/.test(prefix))) { |
| 119 | // eslint-disable-next-line no-console |
| 120 | console.warn( |
| 121 | colors.yellow( |
| 122 | `[vite] Warning: envPrefix option contains values with whitespace, which does not work in practice.`, |
| 123 | ), |
| 124 | ) |
| 125 | } |
| 126 | return envPrefix |
| 127 | } |
no test coverage detected