Commit 854e0f4e by weiw

fix:代理转发相关的配置

parent 63c0ad8c
......@@ -2,6 +2,12 @@ import { defineConfig } from '@rsbuild/core'
import { pluginReact } from '@rsbuild/plugin-react'
import { pluginLess } from '@rsbuild/plugin-less'
import { pluginSvgr } from '@rsbuild/plugin-svgr'
import type { EnvConfKey } from './src/config/env'
import { envConf } from './src/config/env'
const mode = process.env.MODE as EnvConfKey || 'dev'
const apiUrl = envConf[mode].apiUrl || ''
const proxyUrl = envConf[mode].proxyUrl || ''
export default defineConfig({
plugins: [
......@@ -29,7 +35,16 @@ export default defineConfig({
},
source: {
define: {
'import.meta.env.MODE': JSON.stringify('dev'),
'import.meta.env.MODE': JSON.stringify(mode),
},
},
server: {
proxy: {
[apiUrl]: {
target: proxyUrl,
pathRewrite: { [`^${apiUrl}`]: '' },
changeOrigin: true,
},
},
},
})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment