mirror of
https://github.com/imsyy/SPlayer.git
synced 2025-11-25 03:14:57 +08:00
72 lines
1.3 KiB
JavaScript
72 lines
1.3 KiB
JavaScript
import {
|
|
fileURLToPath,
|
|
URL
|
|
} from 'node:url'
|
|
import {
|
|
defineConfig,
|
|
loadEnv
|
|
} from 'vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
import AutoImport from 'unplugin-auto-import/vite'
|
|
import Components from 'unplugin-vue-components/vite'
|
|
import {
|
|
NaiveUiResolver
|
|
} from 'unplugin-vue-components/resolvers'
|
|
|
|
// https://vitejs.dev/config/
|
|
export default ({
|
|
mode
|
|
}) => defineConfig({
|
|
plugins: [vue(), AutoImport({
|
|
imports: [
|
|
'vue',
|
|
{
|
|
'naive-ui': [
|
|
'useDialog',
|
|
'useMessage',
|
|
'useNotification',
|
|
'useLoadingBar'
|
|
]
|
|
}
|
|
]
|
|
}),
|
|
Components({
|
|
resolvers: [NaiveUiResolver()]
|
|
})
|
|
],
|
|
server: {
|
|
port: 2048,
|
|
open: true,
|
|
http: true,
|
|
ssr: false,
|
|
proxy: {
|
|
'/api': {
|
|
target: loadEnv(mode, process.cwd()).VITE_MUSIC_API,
|
|
changeOrigin: true,
|
|
rewrite: path => path.replace(/^\/api/, '')
|
|
},
|
|
}
|
|
},
|
|
css: {
|
|
preprocessorOptions: {
|
|
scss: {
|
|
additionalData: '@import "src/style/index.scss";'
|
|
}
|
|
}
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
'@': fileURLToPath(new URL('./src',
|
|
import.meta.url))
|
|
}
|
|
},
|
|
build: {
|
|
minify: 'terser',
|
|
terserOptions: {
|
|
compress: {
|
|
// 生产环境时移除 console
|
|
pure_funcs: ['console.log'],
|
|
},
|
|
},
|
|
},
|
|
}) |