chore: 🐳 update mock logic
This commit is contained in:
parent
b4f8466cc3
commit
2fbdde2169
|
|
@ -1,5 +1,3 @@
|
|||
VITE_APP_PREVIEW=true
|
||||
VITE_APP_API_BASE_URL=/api
|
||||
VITE_MOCK=true
|
||||
VITE_HTTP_MOCK=true
|
||||
|
||||
VITE_HTTP_MOCK=true
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
NODE_ENV=production
|
||||
VITE_APP_PREVIEW=false
|
||||
VITE_APP_API_URL=/api
|
||||
VITE_APP_API_URL=/api
|
||||
|
|
@ -21,9 +21,6 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
|
|||
const root = process.cwd()
|
||||
const env = loadEnv(mode, root)
|
||||
|
||||
const isHttpMock = env.VITE_HTTP_MOCK === 'true'
|
||||
const isViteMock = env.VITE_MOCK === 'true'
|
||||
|
||||
return {
|
||||
base: env.VITE_APP_PUBLIC_PATH,
|
||||
|
||||
|
|
@ -75,7 +72,7 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
|
|||
watch: true,
|
||||
mockUrlList: [/api/],
|
||||
cwd: process.cwd(),
|
||||
enable: isHttpMock && isViteMock && process.env.NODE_ENV !== 'production',
|
||||
enable: env.VITE_HTTP_MOCK === 'true' && process.env.NODE_ENV !== 'production',
|
||||
}),
|
||||
],
|
||||
|
||||
|
|
@ -106,11 +103,10 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
|
|||
server: {
|
||||
host: true,
|
||||
port: 3000,
|
||||
proxy: isHttpMock && isViteMock && process.env.NODE_ENV !== 'production'
|
||||
proxy: env.VITE_HTTP_MOCK === 'true'
|
||||
? undefined
|
||||
: {
|
||||
'/api': {
|
||||
// backend url
|
||||
target: '',
|
||||
ws: false,
|
||||
changeOrigin: true,
|
||||
|
|
|
|||
Loading…
Reference in New Issue