Skip to content

Commit 3a5db42

Browse files
fix: 修复非正式环境打包报错
1 parent 8aeeb0b commit 3a5db42

File tree

5 files changed

+14
-2
lines changed

5 files changed

+14
-2
lines changed

.env.dev

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,6 @@ VITE_OUT_DIR=dist-dev
2121

2222
# 标题
2323
VITE_APP_TITLE=ElementAdmin
24+
25+
# 是否包分析
26+
VITE_USE_BUNDLE_ANALYZER=false

.env.gitee

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,6 @@ VITE_OUT_DIR=dist-pro
2121

2222
# 标题
2323
VITE_APP_TITLE=ElementAdmin
24+
25+
# 是否包分析
26+
VITE_USE_BUNDLE_ANALYZER=false

.env.pro

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,6 @@ VITE_OUT_DIR=dist-pro
2121

2222
# 标题
2323
VITE_APP_TITLE=ElementAdmin
24+
25+
# 是否包分析
26+
VITE_USE_BUNDLE_ANALYZER=true

.env.test

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,6 @@ VITE_OUT_DIR=dist-test
2121

2222
# 标题
2323
VITE_APP_TITLE=ElementAdmin
24+
25+
# 是否包分析
26+
VITE_USE_BUNDLE_ANALYZER=false

vite.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
111111
build: {
112112
minify: 'terser',
113113
outDir: env.VITE_OUT_DIR || 'dist',
114-
sourcemap: env.VITE_SOURCEMAP === 'true' ? 'inline' : false,
114+
sourcemap: env.VITE_SOURCEMAP === 'true',
115115
// brotliSize: false,
116116
terserOptions: {
117117
compress: {
@@ -120,7 +120,7 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
120120
}
121121
},
122122
rollupOptions: {
123-
plugins: env.NODE_ENV === 'production' ? [visualizer()] : undefined
123+
plugins: env.VITE_USE_BUNDLE_ANALYZER === 'true' ? [visualizer()] : undefined
124124
}
125125
},
126126
server: {

0 commit comments

Comments
 (0)