-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
34 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
# 通用环境变量 | ||
|
||
# 标题 | ||
VITE_APP_TITLE = Vite App 🦕 | ||
VITE_APP_TITLE = Vite App 🦕 | ||
|
||
|
||
# 开发时 Inspect 调试支持,不需要可以关掉以提高开发时性能 | ||
VITE_APP_INSPECT = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,7 @@ | |
|
||
# 标题 | ||
# VITE_APP_TITLE = Vite App 🦕 | ||
|
||
|
||
# 开发时 Inspect 调试支持 | ||
# VITE_APP_Inspect = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { loadEnv } from 'vite' | ||
|
||
const { NODE_ENV } = process.env | ||
|
||
export const isDevelopment = NODE_ENV === 'development' | ||
export const isProduction = NODE_ENV === 'production' | ||
|
||
const generateEnv = () => { | ||
const env = isProduction | ||
? loadEnv('production', '.') | ||
: loadEnv('development', '.') | ||
const newEnv = { | ||
VITE_APP_TITLE: env.VITE_APP_TITLE, | ||
VITE_APP_INSPECT: Boolean( | ||
env.VITE_APP_Inspect === 'true' || false | ||
) | ||
} | ||
return newEnv | ||
} | ||
|
||
export const env = generateEnv() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters