56 lines
1.5 KiB
TypeScript
56 lines
1.5 KiB
TypeScript
import { fileURLToPath, URL } from 'node:url'
|
|
import { defineConfig, loadEnv } from 'vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
import vueDevTools from 'vite-plugin-vue-devtools'
|
|
import tailwindcss from '@tailwindcss/vite'
|
|
import AutoImport from 'unplugin-auto-import/vite'
|
|
import Components from 'unplugin-vue-components/vite'
|
|
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
|
|
import AppLoading from 'vite-plugin-app-loading'
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig(({ mode }) => {
|
|
const env = loadEnv(mode, process.cwd(), '')
|
|
return {
|
|
base: env.VITE_STATIC_URL || '/admin/',
|
|
plugins: [
|
|
vue(),
|
|
tailwindcss(),
|
|
vueDevTools(),
|
|
AppLoading(),
|
|
AutoImport({
|
|
imports: ['vue', 'vue-router', 'pinia'],
|
|
dirs: ['src/stores'],
|
|
resolvers: [ElementPlusResolver()],
|
|
}),
|
|
Components({
|
|
resolvers: [ElementPlusResolver()],
|
|
dirs: ['src/components'],
|
|
}),
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
|
},
|
|
},
|
|
build: {
|
|
outDir: fileURLToPath(new URL('../web/public/admin', import.meta.url)),
|
|
emptyOutDir: true,
|
|
},
|
|
server: {
|
|
host: '127.0.0.1',
|
|
port: 3007,
|
|
proxy: {
|
|
'/api/admin': {
|
|
target: 'http://127.0.0.1:3000',
|
|
changeOrigin: true,
|
|
},
|
|
'/images': {
|
|
target: 'http://127.0.0.1:3000',
|
|
changeOrigin: true,
|
|
},
|
|
},
|
|
},
|
|
}
|
|
})
|