| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- import { defineConfig } from 'vite'
- import vue from '@vitejs/plugin-vue'
- import AutoImport from 'unplugin-auto-import/vite'
- import Components from 'unplugin-vue-components/vite'
- import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
- import Icons from 'unplugin-icons/vite'
- import IconsResolver from 'unplugin-icons/resolvers'
- import path from 'path'
- // https://vitejs.dev/config/
- export default defineConfig({
- base: './',
- resolve: {
- alias: {
- '@': path.resolve(__dirname, './src')
- }
- },
- plugins: [
- vue(),
- AutoImport({
- resolvers: [
- ElementPlusResolver(),
- IconsResolver({
- prefix: 'Icon'
- })
- ],
- imports: [
- 'vue',
- {
- '@/api/index': [['default', '$api']]
- }
- ],
- dts: './src/auto-imports.d.ts'
- }),
- Components({
- resolvers: [
- ElementPlusResolver(),
- IconsResolver({
- enabledCollections: ['ep']
- })
- ]
- }),
- Icons({
- autoInstall: true
- })
- ],
- server: {
- port: 80,
- hmr: true,
- open: true,
- proxy: {
- '/api': {
- target: 'http://192.168.0.161',
- changeOrigin: true,
- rewrite: (path: string) => path.replace(/^\/api/, '')
- }
- }
- },
- build: {
- rollupOptions: {
- output: {
- entryFileNames: `[name].[hash].js`,
- chunkFileNames: `[name].[hash].js`,
- assetFileNames: `[name].[hash].[ext]`
- }
- }
- }
- })
|