Files
AlgerMusicPlayer/vite.config.ts

68 lines
1.8 KiB
TypeScript
Raw Normal View History

2024-05-21 10:16:30 +08:00
import vue from '@vitejs/plugin-vue';
import path from 'path';
// import VueDevTools from 'vite-plugin-vue-devtools'
2024-05-21 10:16:30 +08:00
import AutoImport from 'unplugin-auto-import/vite';
import { NaiveUiResolver } from 'unplugin-vue-components/resolvers';
import Components from 'unplugin-vue-components/vite';
import { defineConfig } from 'vite';
2024-05-21 11:24:33 +08:00
import viteCompression from 'vite-plugin-compression';
2021-07-19 17:36:48 +08:00
export default defineConfig({
plugins: [
vue(),
2024-05-21 11:24:33 +08:00
viteCompression(),
// VueDevTools(),
AutoImport({
imports: [
'vue',
{
2024-05-21 10:16:30 +08:00
'naive-ui': ['useDialog', 'useMessage', 'useNotification', 'useLoadingBar'],
},
],
}),
Components({
resolvers: [NaiveUiResolver()],
}),
],
2023-12-18 23:07:44 +08:00
base: './',
2021-07-19 17:36:48 +08:00
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
2021-07-19 17:36:48 +08:00
},
},
2021-10-11 12:06:53 +08:00
server: {
2024-05-21 10:16:30 +08:00
host: '0.0.0.0',
2023-12-18 16:41:56 +08:00
// 指定端口
port: 4488,
2021-10-11 12:06:53 +08:00
proxy: {
// with options
[process.env.VITE_API_LOCAL as string]: {
2024-12-07 11:38:56 +08:00
target: process.env.VITE_API,
2021-10-11 12:06:53 +08:00
changeOrigin: true,
rewrite: (path) => path.replace(new RegExp(`^${process.env.VITE_API_LOCAL}`), ''),
2021-10-11 12:06:53 +08:00
},
2024-12-07 11:38:56 +08:00
[process.env.VITE_API_MUSIC_PROXY as string]: {
target: process.env.VITE_API_MUSIC,
2021-11-08 17:04:38 +08:00
changeOrigin: true,
2024-12-07 11:38:56 +08:00
rewrite: (path) => path.replace(new RegExp(`^${process.env.VITE_API_MUSIC_PROXY}`), ''),
},
[process.env.VITE_API_PROXY_MUSIC as string]: {
target: process.env.VITE_API_PROXY,
changeOrigin: true,
rewrite: (path) => path.replace(new RegExp(`^${process.env.VITE_API_PROXY_MUSIC}`), ''),
2021-11-08 17:04:38 +08:00
},
2021-10-11 12:06:53 +08:00
},
},
build: {
rollupOptions: {
output: {
manualChunks: {
vendor: ['vue', 'axios'],
naiveui: ['naive-ui'],
lodash: ['lodash'],
},
},
},
},
2024-05-21 10:16:30 +08:00
});