chore: dev 环境下更换为反向代理方式访问接口
This commit is contained in:
parent
b1e084edae
commit
08b60c99cc
@ -3,8 +3,8 @@ NODE_ENV = development
|
|||||||
|
|
||||||
# 下面是自定义的环境变量,可以修改(命名必须以 VITE_ 开头)
|
# 下面是自定义的环境变量,可以修改(命名必须以 VITE_ 开头)
|
||||||
|
|
||||||
# 后端接口公共路径
|
# 后端接口公共路径(如果解决跨域问题采用反向代理就只需写公共路径)
|
||||||
VITE_BASE_API = 'https://mock.mengxuegu.com/mock/63218b5fb4c53348ed2bc212/api/v1'
|
VITE_BASE_API = '/api/v1'
|
||||||
|
|
||||||
# 路由模式 hash 或 html5
|
# 路由模式 hash 或 html5
|
||||||
VITE_ROUTER_HISTORY = 'hash'
|
VITE_ROUTER_HISTORY = 'hash'
|
||||||
|
@ -3,7 +3,7 @@ NODE_ENV = production
|
|||||||
|
|
||||||
# 下面是自定义的环境变量,可以修改(命名必须以 VITE_ 开头)
|
# 下面是自定义的环境变量,可以修改(命名必须以 VITE_ 开头)
|
||||||
|
|
||||||
# 后端接口公共路径
|
# 后端接口公共路径(如果解决跨域问题采用 CORS 就需要写全路径)
|
||||||
VITE_BASE_API = 'https://mock.mengxuegu.com/mock/63218b5fb4c53348ed2bc212/api/v1'
|
VITE_BASE_API = 'https://mock.mengxuegu.com/mock/63218b5fb4c53348ed2bc212/api/v1'
|
||||||
|
|
||||||
# 路由模式 hash 或 html5
|
# 路由模式 hash 或 html5
|
||||||
|
@ -3,7 +3,7 @@ NODE_ENV = production
|
|||||||
|
|
||||||
# 下面是自定义的环境变量,可以修改(命名必须以 VITE_ 开头)
|
# 下面是自定义的环境变量,可以修改(命名必须以 VITE_ 开头)
|
||||||
|
|
||||||
# 后端接口公共路径
|
# 后端接口公共路径(如果解决跨域问题采用 CORS 就需要写全路径)
|
||||||
VITE_BASE_API = 'https://mock.mengxuegu.com/mock/63218b5fb4c53348ed2bc212/api/v1'
|
VITE_BASE_API = 'https://mock.mengxuegu.com/mock/63218b5fb4c53348ed2bc212/api/v1'
|
||||||
|
|
||||||
# 路由模式 hash 或 html5
|
# 路由模式 hash 或 html5
|
||||||
|
@ -55,7 +55,7 @@
|
|||||||
"husky": "^8.0.1",
|
"husky": "^8.0.1",
|
||||||
"lint-staged": "^13.0.3",
|
"lint-staged": "^13.0.3",
|
||||||
"prettier": "^2.7.1",
|
"prettier": "^2.7.1",
|
||||||
"sass": "^1.54.9",
|
"sass": "^1.55.0",
|
||||||
"terser": "^5.15.0",
|
"terser": "^5.15.0",
|
||||||
"typescript": "^4.8.3",
|
"typescript": "^4.8.3",
|
||||||
"unocss": "^0.45.22",
|
"unocss": "^0.45.22",
|
||||||
|
38
pnpm-lock.yaml
generated
38
pnpm-lock.yaml
generated
@ -28,7 +28,7 @@ specifiers:
|
|||||||
path-to-regexp: ^6.2.1
|
path-to-regexp: ^6.2.1
|
||||||
pinia: ^2.0.22
|
pinia: ^2.0.22
|
||||||
prettier: ^2.7.1
|
prettier: ^2.7.1
|
||||||
sass: ^1.54.9
|
sass: ^1.55.0
|
||||||
screenfull: ^6.0.2
|
screenfull: ^6.0.2
|
||||||
terser: ^5.15.0
|
terser: ^5.15.0
|
||||||
typescript: ^4.8.3
|
typescript: ^4.8.3
|
||||||
@ -73,11 +73,11 @@ devDependencies:
|
|||||||
husky: 8.0.1
|
husky: 8.0.1
|
||||||
lint-staged: 13.0.3
|
lint-staged: 13.0.3
|
||||||
prettier: 2.7.1
|
prettier: 2.7.1
|
||||||
sass: 1.54.9
|
sass: 1.55.0
|
||||||
terser: 5.15.0
|
terser: 5.15.0
|
||||||
typescript: 4.8.3
|
typescript: 4.8.3
|
||||||
unocss: 0.45.22_vite@3.1.3
|
unocss: 0.45.22_vite@3.1.3
|
||||||
vite: 3.1.3_sass@1.54.9+terser@5.15.0
|
vite: 3.1.3_sass@1.55.0+terser@5.15.0
|
||||||
vite-plugin-svg-icons: 2.0.1_vite@3.1.3
|
vite-plugin-svg-icons: 2.0.1_vite@3.1.3
|
||||||
vue-eslint-parser: 9.1.0_eslint@8.23.1
|
vue-eslint-parser: 9.1.0_eslint@8.23.1
|
||||||
vue-tsc: 0.40.13_typescript@4.8.3
|
vue-tsc: 0.40.13_typescript@4.8.3
|
||||||
@ -92,8 +92,8 @@ packages:
|
|||||||
'@jridgewell/trace-mapping': 0.3.15
|
'@jridgewell/trace-mapping': 0.3.15
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@antfu/install-pkg/0.1.0:
|
/@antfu/install-pkg/0.1.1:
|
||||||
resolution: {integrity: sha512-VaIJd3d1o7irZfK1U0nvBsHMyjkuyMP3HKYVV53z8DKyulkHKmjhhtccXO51WSPeeSHIeoJEoNOKavYpS7jkZw==}
|
resolution: {integrity: sha512-LyB/8+bSfa0DFGC06zpCEfs89/XoWZwws5ygEa5D+Xsm3OfI+aXQ86VgVG7Acyef+rSZ5HE7J8rrxzrQeM3PjQ==}
|
||||||
dependencies:
|
dependencies:
|
||||||
execa: 5.1.1
|
execa: 5.1.1
|
||||||
find-up: 5.0.0
|
find-up: 5.0.0
|
||||||
@ -186,8 +186,8 @@ packages:
|
|||||||
'@floating-ui/core': 1.0.1
|
'@floating-ui/core': 1.0.1
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@humanwhocodes/config-array/0.10.4:
|
/@humanwhocodes/config-array/0.10.5:
|
||||||
resolution: {integrity: sha512-mXAIHxZT3Vcpg83opl1wGlVZ9xydbfZO3r5YfRSH6Gpp2J/PfdBP0wbDa2sO6/qRbcalpoevVyW6A/fI6LfeMw==}
|
resolution: {integrity: sha512-XVVDtp+dVvRxMoxSiSfasYaG02VEe1qH5cKgMQJWhol6HwzbcqoCMJi8dAGoYAO57jhUyhI6cWuRiTcRaDaYug==}
|
||||||
engines: {node: '>=10.10.0'}
|
engines: {node: '>=10.10.0'}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@humanwhocodes/object-schema': 1.2.1
|
'@humanwhocodes/object-schema': 1.2.1
|
||||||
@ -217,7 +217,7 @@ packages:
|
|||||||
/@iconify/utils/2.0.0:
|
/@iconify/utils/2.0.0:
|
||||||
resolution: {integrity: sha512-thvwZ6m3frWJiOYwRdHPSPGC25rmyvDl0vXdQ8ocRJZx31m8Pn4y7V1mTc5UReR6MiAj+hrV2UPZQjx7zI960g==}
|
resolution: {integrity: sha512-thvwZ6m3frWJiOYwRdHPSPGC25rmyvDl0vXdQ8ocRJZx31m8Pn4y7V1mTc5UReR6MiAj+hrV2UPZQjx7zI960g==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@antfu/install-pkg': 0.1.0
|
'@antfu/install-pkg': 0.1.1
|
||||||
'@antfu/utils': 0.5.2
|
'@antfu/utils': 0.5.2
|
||||||
'@iconify/types': 2.0.0
|
'@iconify/types': 2.0.0
|
||||||
debug: 4.3.4
|
debug: 4.3.4
|
||||||
@ -629,7 +629,7 @@ packages:
|
|||||||
'@unocss/scope': 0.45.22
|
'@unocss/scope': 0.45.22
|
||||||
'@unocss/transformer-directives': 0.45.22
|
'@unocss/transformer-directives': 0.45.22
|
||||||
magic-string: 0.26.3
|
magic-string: 0.26.3
|
||||||
vite: 3.1.3_sass@1.54.9+terser@5.15.0
|
vite: 3.1.3_sass@1.55.0+terser@5.15.0
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@vitejs/plugin-vue/3.1.0_vite@3.1.3+vue@3.2.39:
|
/@vitejs/plugin-vue/3.1.0_vite@3.1.3+vue@3.2.39:
|
||||||
@ -639,7 +639,7 @@ packages:
|
|||||||
vite: ^3.0.0
|
vite: ^3.0.0
|
||||||
vue: ^3.2.25
|
vue: ^3.2.25
|
||||||
dependencies:
|
dependencies:
|
||||||
vite: 3.1.3_sass@1.54.9+terser@5.15.0
|
vite: 3.1.3_sass@1.55.0+terser@5.15.0
|
||||||
vue: 3.2.39
|
vue: 3.2.39
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
@ -1789,7 +1789,7 @@ packages:
|
|||||||
hasBin: true
|
hasBin: true
|
||||||
dependencies:
|
dependencies:
|
||||||
'@eslint/eslintrc': 1.3.2
|
'@eslint/eslintrc': 1.3.2
|
||||||
'@humanwhocodes/config-array': 0.10.4
|
'@humanwhocodes/config-array': 0.10.5
|
||||||
'@humanwhocodes/gitignore-to-minimatch': 1.0.2
|
'@humanwhocodes/gitignore-to-minimatch': 1.0.2
|
||||||
'@humanwhocodes/module-importer': 1.0.1
|
'@humanwhocodes/module-importer': 1.0.1
|
||||||
ajv: 6.12.6
|
ajv: 6.12.6
|
||||||
@ -2796,8 +2796,8 @@ packages:
|
|||||||
resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==}
|
resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/node-fetch-native/0.1.5:
|
/node-fetch-native/0.1.7:
|
||||||
resolution: {integrity: sha512-4NYY0JOTYFsahDjKy4gId6uuf7TPzkIDSDMuvtmlFd2Jf25tj9fQsDD5+kLdzM7sm6BbG8lL/154tdrsgN25Zw==}
|
resolution: {integrity: sha512-hps7dFJM0IEF056JftDSSjWDAwW9v2clwHoUJiHyYgl+ojoqjKyWybljMlpTmlC1O+864qovNlRLyAIjRxu9Ag==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/normalize-path/3.0.0:
|
/normalize-path/3.0.0:
|
||||||
@ -2873,7 +2873,7 @@ packages:
|
|||||||
resolution: {integrity: sha512-OH2xVeRPNsHkx+JFdq1ewe9EwVDfTrv6lsBHpIx8wIWXowP5FyLhhYVaXIVlPsW542rt7gmwK14FwIDWUXEO+Q==}
|
resolution: {integrity: sha512-OH2xVeRPNsHkx+JFdq1ewe9EwVDfTrv6lsBHpIx8wIWXowP5FyLhhYVaXIVlPsW542rt7gmwK14FwIDWUXEO+Q==}
|
||||||
dependencies:
|
dependencies:
|
||||||
destr: 1.1.1
|
destr: 1.1.1
|
||||||
node-fetch-native: 0.1.5
|
node-fetch-native: 0.1.7
|
||||||
ufo: 0.8.5
|
ufo: 0.8.5
|
||||||
undici: 5.10.0
|
undici: 5.10.0
|
||||||
dev: true
|
dev: true
|
||||||
@ -3250,8 +3250,8 @@ packages:
|
|||||||
ret: 0.1.15
|
ret: 0.1.15
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/sass/1.54.9:
|
/sass/1.55.0:
|
||||||
resolution: {integrity: sha512-xb1hjASzEH+0L0WI9oFjqhRi51t/gagWnxLiwUNMltA0Ab6jIDkAacgKiGYKM9Jhy109osM7woEEai6SXeJo5Q==}
|
resolution: {integrity: sha512-Pk+PMy7OGLs9WaxZGJMn7S96dvlyVBwwtToX895WmCpAOr5YiJYEUJfiJidMuKb613z2xNWcXCHEuOvjZbqC6A==}
|
||||||
engines: {node: '>=12.0.0'}
|
engines: {node: '>=12.0.0'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
dependencies:
|
dependencies:
|
||||||
@ -3771,12 +3771,12 @@ packages:
|
|||||||
pathe: 0.2.0
|
pathe: 0.2.0
|
||||||
svg-baker: 1.7.0
|
svg-baker: 1.7.0
|
||||||
svgo: 2.8.0
|
svgo: 2.8.0
|
||||||
vite: 3.1.3_sass@1.54.9+terser@5.15.0
|
vite: 3.1.3_sass@1.55.0+terser@5.15.0
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/vite/3.1.3_sass@1.54.9+terser@5.15.0:
|
/vite/3.1.3_sass@1.55.0+terser@5.15.0:
|
||||||
resolution: {integrity: sha512-/3XWiktaopByM5bd8dqvHxRt5EEgRikevnnrpND0gRfNkrMrPaGGexhtLCzv15RcCMtV2CLw+BPas8YFeSG0KA==}
|
resolution: {integrity: sha512-/3XWiktaopByM5bd8dqvHxRt5EEgRikevnnrpND0gRfNkrMrPaGGexhtLCzv15RcCMtV2CLw+BPas8YFeSG0KA==}
|
||||||
engines: {node: ^14.18.0 || >=16.0.0}
|
engines: {node: ^14.18.0 || >=16.0.0}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
@ -3799,7 +3799,7 @@ packages:
|
|||||||
postcss: 8.4.16
|
postcss: 8.4.16
|
||||||
resolve: 1.22.1
|
resolve: 1.22.1
|
||||||
rollup: 2.78.1
|
rollup: 2.78.1
|
||||||
sass: 1.54.9
|
sass: 1.55.0
|
||||||
terser: 5.15.0
|
terser: 5.15.0
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
fsevents: 2.3.2
|
fsevents: 2.3.2
|
||||||
|
@ -30,17 +30,17 @@ export default (configEnv: ConfigEnv): UserConfigExport => {
|
|||||||
/** 跨域设置允许 */
|
/** 跨域设置允许 */
|
||||||
cors: true,
|
cors: true,
|
||||||
/** 端口被占用时,是否直接退出 */
|
/** 端口被占用时,是否直接退出 */
|
||||||
strictPort: false
|
strictPort: false,
|
||||||
/** 接口代理 */
|
/** 接口代理 */
|
||||||
// proxy: {
|
proxy: {
|
||||||
// "/mock-api": {
|
"/api/v1": {
|
||||||
// target: "https://vue-typescript-admin-mock-server-armour.vercel.app/mock-api",
|
target: "https://mock.mengxuegu.com/mock/63218b5fb4c53348ed2bc212/api/v1",
|
||||||
// ws: true,
|
ws: true,
|
||||||
// /** 是否允许跨域 */
|
/** 是否允许跨域 */
|
||||||
// changeOrigin: true,
|
changeOrigin: true,
|
||||||
// rewrite: (path) => path.replace("/mock-api", "")
|
rewrite: (path) => path.replace("/api/v1", "")
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
},
|
},
|
||||||
build: {
|
build: {
|
||||||
/** 消除打包大小超过 500kb 警告 */
|
/** 消除打包大小超过 500kb 警告 */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user