forked from gzt/A8000
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.1 KiB
44 lines
1.1 KiB
import { defineConfig } from 'vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
import { fileURLToPath, URL } from 'url'
|
|
import AutoImport from 'unplugin-auto-import/vite'
|
|
import Components from 'unplugin-vue-components/vite'
|
|
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig({
|
|
base: './',
|
|
plugins: [
|
|
vue(),
|
|
AutoImport({
|
|
resolvers: [ElementPlusResolver({ importStyle: false })],
|
|
}),
|
|
Components({
|
|
resolvers: [ElementPlusResolver({ importStyle: false })],
|
|
}),
|
|
],
|
|
resolve: {
|
|
extensions: ['.js', '.ts', '.vue', '.json'], // 添加 .ts 扩展名解析
|
|
alias: {
|
|
'@': fileURLToPath(new URL('./src', import.meta.url)), // 确保将 @ 指向 src 目录
|
|
},
|
|
},
|
|
build: {
|
|
minify: 'terser',
|
|
terserOptions: {
|
|
compress: {
|
|
drop_console: true,
|
|
drop_debugger: true,
|
|
},
|
|
},
|
|
},
|
|
server: {
|
|
proxy: {
|
|
'/api': {
|
|
target: 'http://localhost',
|
|
changeOrigin: true,
|
|
// rewrite: (path) => path.replace(/^\/api/, ''),
|
|
},
|
|
},
|
|
},
|
|
})
|