init commit
This commit is contained in:
16
vite.config.js
Normal file
16
vite.config.js
Normal file
@@ -0,0 +1,16 @@
|
||||
import { defineConfig, loadEnv } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig(({ command, mode }) => {
|
||||
// 加载环境变量
|
||||
// Vite 会自动加载 .env 文件,但这里显式加载以确保在配置中可以使用
|
||||
const env = loadEnv(mode, process.cwd(), '')
|
||||
return {
|
||||
base: './',
|
||||
plugins: [vue()],
|
||||
// 确保环境变量可以在客户端代码中访问
|
||||
// Vite 会自动将 VITE_ 开头的环境变量注入到 import.meta.env 中
|
||||
envPrefix: 'VITE_',
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user