| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- 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 AutoImport from 'unplugin-auto-import/vite'
- import Components from 'unplugin-vue-components/vite'
- import { TDesignResolver } from 'unplugin-vue-components/resolvers'
- // https://vitejs.dev/config/
- export default defineConfig(({ command, mode }) => {
- const env = loadEnv(mode, process.cwd(), '')
- return {
- plugins: [
- vue(),
- vueDevTools(),
- AutoImport({
- resolvers: [
- TDesignResolver({
- library: 'vue-next'
- })
- ]
- }),
- Components({
- resolvers: [
- TDesignResolver({
- library: 'vue-next'
- })
- ]
- }),
- ],
- resolve: {
- alias: {
- '@': fileURLToPath(new URL('./src', import.meta.url))
- }
- },
- server: {
- proxy: {
- '/api': {
- target: env.VITE_PROXY_ENDPOINT,
- changeOrigin: true,
- rewrite: (path) => path.replace(/^\/api/, '')
- }
- }
- }
- }
- })
|