Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sdream-ai-fe
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
侯明涛
sdream-ai-fe
Commits
50f29537
Commit
50f29537
authored
Aug 28, 2025
by
weiw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:增加环境变量 用来控制区分 消金 和 外网
parent
cfba0944
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
2 deletions
+21
-2
.env.development
+3
-0
.env.production
+4
-1
.env.sit
+4
-1
package.json
+1
-0
rsbuild.config.ts
+9
-0
No files found.
.env.development
View file @
50f29537
MODE=dev
MODE=dev
VITE_OUTPUT_OBJ=open
\ No newline at end of file
.env.production
View file @
50f29537
MODE='prod'
MODE=prod
VITE_OUTPUT_OBJ=open
\ No newline at end of file
.env.sit
View file @
50f29537
MODE='sit'
MODE=sit
VITE_OUTPUT_OBJ=inner
\ No newline at end of file
package.json
View file @
50f29537
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
"author"
:
"HoMeTown"
,
"author"
:
"HoMeTown"
,
"scripts"
:
{
"scripts"
:
{
"dev"
:
"rsbuild dev --open"
,
"dev"
:
"rsbuild dev --open"
,
"dev:sit"
:
"rsbuild dev --open --env-mode sit"
,
"build:sit"
:
"rsbuild build --env-mode sit"
,
"build:sit"
:
"rsbuild build --env-mode sit"
,
"build"
:
"rsbuild build"
,
"build"
:
"rsbuild build"
,
"doctor"
:
"RSDOCTOR=true pnpm build"
,
"doctor"
:
"RSDOCTOR=true pnpm build"
,
...
...
rsbuild.config.ts
View file @
50f29537
...
@@ -9,6 +9,14 @@ const mode = process.env.MODE as EnvConfKey || 'dev'
...
@@ -9,6 +9,14 @@ const mode = process.env.MODE as EnvConfKey || 'dev'
const
apiUrl
=
envConf
[
mode
].
apiUrl
||
''
const
apiUrl
=
envConf
[
mode
].
apiUrl
||
''
const
proxyUrl
=
envConf
[
mode
].
proxyUrl
||
''
const
proxyUrl
=
envConf
[
mode
].
proxyUrl
||
''
// 处理 VITE_ 前缀的环境变量
const
viteEnvVars
:
Record
<
string
,
string
>
=
{}
Object
.
keys
(
process
.
env
).
forEach
((
key
)
=>
{
if
(
key
.
startsWith
(
'VITE_'
))
{
viteEnvVars
[
`import.meta.env.
${
key
}
`
]
=
JSON
.
stringify
(
process
.
env
[
key
])
}
})
export
default
defineConfig
({
export
default
defineConfig
({
plugins
:
[
plugins
:
[
pluginReact
(),
pluginReact
(),
...
@@ -36,6 +44,7 @@ export default defineConfig({
...
@@ -36,6 +44,7 @@ export default defineConfig({
source
:
{
source
:
{
define
:
{
define
:
{
'import.meta.env.MODE'
:
JSON
.
stringify
(
mode
),
'import.meta.env.MODE'
:
JSON
.
stringify
(
mode
),
...
viteEnvVars
,
},
},
},
},
server
:
{
server
:
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment