|
|
@@ -1,28 +1,32 @@
|
|
|
import { fileURLToPath, URL } from 'node:url'
|
|
|
|
|
|
-import { defineConfig } from 'vite'
|
|
|
+import { defineConfig, loadEnv } from 'vite'
|
|
|
import vue from '@vitejs/plugin-vue'
|
|
|
import vueJsx from '@vitejs/plugin-vue-jsx'
|
|
|
import vueDevTools from 'vite-plugin-vue-devtools'
|
|
|
|
|
|
// https://vitejs.dev/config/
|
|
|
-export default defineConfig({
|
|
|
- plugins: [vue(), vueJsx(), vueDevTools()],
|
|
|
- resolve: {
|
|
|
- alias: {
|
|
|
- '@': fileURLToPath(new URL('./src', import.meta.url)),
|
|
|
- '@element-plus/icons-vue': '@cacp/svg-icons'
|
|
|
+export default defineConfig(({ mode }) => {
|
|
|
+ const env = loadEnv(mode, process.cwd())
|
|
|
+ const { VITE_BASE } = env
|
|
|
+ return {
|
|
|
+ plugins: [vue(), vueJsx(), vueDevTools()],
|
|
|
+ resolve: {
|
|
|
+ alias: {
|
|
|
+ '@': fileURLToPath(new URL('./src', import.meta.url)),
|
|
|
+ '@element-plus/icons-vue': '@cacp/svg-icons'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ server: {
|
|
|
+ port: 8080,
|
|
|
+ // 是否自动在浏览器打开
|
|
|
+ open: true
|
|
|
+ },
|
|
|
+ base: '/' + VITE_BASE + '/',
|
|
|
+ build: {
|
|
|
+ target: 'esnext',
|
|
|
+ sourcemap: false,
|
|
|
+ outDir: VITE_BASE
|
|
|
}
|
|
|
- },
|
|
|
- server: {
|
|
|
- port: 8080,
|
|
|
- // 是否自动在浏览器打开
|
|
|
- open: true
|
|
|
- },
|
|
|
- base: '/hg-lvke-web/',
|
|
|
- build: {
|
|
|
- target: 'esnext',
|
|
|
- sourcemap: false,
|
|
|
- outDir: 'hg-lvke-web'
|
|
|
}
|
|
|
})
|