feat: better vite.config.ts

This commit is contained in:
liujiayii 2025-01-24 09:12:52 +08:00
parent 3ac6978141
commit 3729b1bc7c

View File

@ -19,7 +19,7 @@ import ViteRestart from 'vite-plugin-restart'
import { copyNativeRes } from './vite-plugins/copyNativeRes' import { copyNativeRes } from './vite-plugins/copyNativeRes'
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default ({ command, mode }) => { export default defineConfig(({ command, mode }) => {
// console.log(mode === process.env.NODE_ENV) // true // console.log(mode === process.env.NODE_ENV) // true
// mode: 区分生产环境还是开发环境 // mode: 区分生产环境还是开发环境
@ -46,7 +46,7 @@ export default ({ command, mode }) => {
} = env } = env
console.log('环境变量 env -> ', env) console.log('环境变量 env -> ', env)
return defineConfig({ return {
envDir: './env', // 自定义env目录 envDir: './env', // 自定义env目录
plugins: [ plugins: [
@ -156,5 +156,5 @@ export default ({ command, mode }) => {
}, },
}, },
}, },
}) }
} })