53 行
1.3 KiB
JavaScript
53 行
1.3 KiB
JavaScript
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'
|
|
|
|
export default defineConfig({
|
|
plugins: [
|
|
vue(),
|
|
AutoImport({
|
|
resolvers: [ElementPlusResolver()],
|
|
}),
|
|
Components({
|
|
resolvers: [ElementPlusResolver()],
|
|
}),
|
|
],
|
|
server: {
|
|
port: 5173,
|
|
proxy: {
|
|
'/api': {
|
|
target: 'http://localhost:8000',
|
|
changeOrigin: true,
|
|
},
|
|
},
|
|
},
|
|
build: {
|
|
chunkSizeWarningLimit: 800,
|
|
rollupOptions: {
|
|
output: {
|
|
manualChunks(id) {
|
|
if (id.includes('node_modules/element-plus')) {
|
|
return 'element-plus'
|
|
}
|
|
if (id.includes('node_modules/@element-plus/icons-vue')) {
|
|
return 'element-icons'
|
|
}
|
|
if (
|
|
id.includes('node_modules/vue/') ||
|
|
id.includes('node_modules/vue-router') ||
|
|
id.includes('node_modules/@vue/') ||
|
|
id.includes('node_modules/pinia')
|
|
) {
|
|
return 'vue-vendor'
|
|
}
|
|
if (id.includes('node_modules')) {
|
|
return 'vendor'
|
|
}
|
|
},
|
|
},
|
|
},
|
|
},
|
|
})
|