Skip to content

Commit b8fb91e

Browse files
committed
check if env is defined
1 parent dc6b71d commit b8fb91e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

vite.config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ export default defineConfig(({ mode }) => {
99
const env = loadEnv(mode, process.cwd(), '')
1010
const buildTarget = env.VITE_BUILD_TARGET || 'web'
1111

12+
if (!env.VITE_API_URL) {
13+
throw new Error('VITE_API_URL is not defined, create an .env file with this variable')
14+
}
15+
1216
return {
1317
plugins: [
1418
ViteEjsPlugin((viteConfig) => {

0 commit comments

Comments
 (0)