fix: 修复vite热重启后proxy失效问题
This commit is contained in:
parent
5bd380037c
commit
5ce2150706
@ -16,7 +16,7 @@ export function wrapperEnv(envOptions) {
|
|||||||
if (['VITE_PORT'].includes(key)) {
|
if (['VITE_PORT'].includes(key)) {
|
||||||
val = +val
|
val = +val
|
||||||
}
|
}
|
||||||
if (key === 'VITE_PROXY' && val) {
|
if (key === 'VITE_PROXY' && val && typeof val === 'string') {
|
||||||
try {
|
try {
|
||||||
val = JSON.parse(val.replace(/'/g, '"'))
|
val = JSON.parse(val.replace(/'/g, '"'))
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -24,9 +24,9 @@ export function wrapperEnv(envOptions) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ret[key] = val
|
ret[key] = val
|
||||||
if (typeof key === 'string') {
|
if (typeof val === 'string') {
|
||||||
process.env[key] = val
|
process.env[key] = val
|
||||||
} else if (typeof key === 'object') {
|
} else if (typeof val === 'object') {
|
||||||
process.env[key] = JSON.stringify(val)
|
process.env[key] = JSON.stringify(val)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user