19
11/24
vue3+vite+多环境发面到二级目录配置
//vite.config.js import {defineConfig, loadEnv} from 'vite' import vue from '@vitejs/plugin-vue' // https://vite.dev/config/ export default defineConfig(({mode}) => { const env = loadEnv(mode, process.cwd(), ''); let baseDir = env.VITE_BASE_PATH; console.log('mode:' + mode + ', baseDir:' + baseDir); return { base: baseDir, plugins: [vue()], server: { host: '0.0.0.0' }, } }); //....