-
Notifications
You must be signed in to change notification settings - Fork 11.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* perf: 检查代码 * feat: proxy setting * chore: 调整为测试环境使用 `proxy`
- Loading branch information
1 parent
66cecb6
commit bf5c0cd
Showing
8 changed files
with
28 additions
and
16 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,6 +1,5 @@ | ||
# Glob API URL | ||
VITE_GLOB_API_URL=/api | ||
|
||
VITE_APP_API_BASE_URL=http://localhost:3002/ | ||
VITE_GLOB_API_URL=http://localhost:3002 | ||
|
||
# Glob API Timeout (ms) | ||
VITE_GLOB_API_TIMEOUT=100000 |
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 @@ | ||
VITE_GLOB_HTTP_PROXY=Y |
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 @@ | ||
export * from './proxy' |
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,16 @@ | ||
import type { ProxyOptions } from 'vite' | ||
|
||
export function createViteProxy(isOpenProxy: boolean, viteEnv: ImportMetaEnv) { | ||
if (!isOpenProxy) | ||
return | ||
|
||
const proxy: Record<string, string | ProxyOptions> = { | ||
'/api': { | ||
target: viteEnv.VITE_GLOB_API_URL, | ||
changeOrigin: true, | ||
rewrite: path => path.replace(/^\/api/, ''), | ||
}, | ||
} | ||
|
||
return proxy | ||
} |
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
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,8 +1,6 @@ | ||
function includeCode(text: string | null | undefined) { | ||
const regexp = /^(?:\s{4}|\t).+/gm | ||
if (text?.includes(' = ') || text?.match(regexp)) | ||
return true | ||
return false | ||
return !!(text?.includes(' = ') || text?.match(regexp)) | ||
} | ||
|
||
export default includeCode |
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
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