| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- 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(),
- AutoImport({
- imports:['vue'],
- dts:"src/auto-import.d.ts" // 会自动生成此文件
- }),
- 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/, '')
- }
- }
- }
- }
- })
|