Skip to content

Commit e7f82eb

Browse files
committed
更新 vite.config.ts 文件,修改 __APP_VERSION__ 的定义:1) 开发环境显示为 'dev';2) 演示模式显示实际版本号。
------------------------------------- [deploy]
1 parent 0541941 commit e7f82eb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

vite.config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ import vue from '@vitejs/plugin-vue'
33
import dts from 'vite-plugin-dts'
44
import { resolve } from 'path'
55
import cssInjectedByJs from 'vite-plugin-css-injected-by-js'
6-
import { loadEnv } from 'vite'
76
import { version } from './package.json'
87

98
export default defineConfig(({ mode }) => {
109
const isDemo = mode === 'demo'
11-
const env = loadEnv(mode, process.cwd(), '')
10+
const isDev = mode === 'development'
1211

1312
return {
1413
base: '/vue-expression-editor/',
1514
define: {
16-
__APP_VERSION__: JSON.stringify(version)
15+
// 开发环境显示 dev,演示模式显示实际版本号
16+
'__APP_VERSION__': JSON.stringify(isDev ? 'dev' : `v${version}`)
1717
},
1818
plugins: [
1919
vue(),

0 commit comments

Comments
 (0)