Skip to content

Commit

Permalink
feat: better vite.config.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
liujiayii committed Jan 24, 2025
1 parent 3ac6978 commit 3729b1b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import ViteRestart from 'vite-plugin-restart'
import { copyNativeRes } from './vite-plugins/copyNativeRes'

// https://vitejs.dev/config/
export default ({ command, mode }) => {
export default defineConfig(({ command, mode }) => {
// console.log(mode === process.env.NODE_ENV) // true

// mode: 区分生产环境还是开发环境
Expand All @@ -46,7 +46,7 @@ export default ({ command, mode }) => {
} = env
console.log('环境变量 env -> ', env)

return defineConfig({
return {
envDir: './env', // 自定义env目录

plugins: [
Expand Down Expand Up @@ -156,5 +156,5 @@ export default ({ command, mode }) => {
},
},
},
})
}
}
})

0 comments on commit 3729b1b

Please sign in to comment.