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.
48 lines
1.2 KiB
48 lines
1.2 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'
|
|
import packageJson from './package.json'
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig({
|
|
define: {
|
|
__APP_VERSION__: JSON.stringify(packageJson.version),
|
|
},
|
|
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:8888',
|
|
changeOrigin: true,
|
|
// rewrite: (path) => path.replace(/^\/api/, ''),
|
|
},
|
|
},
|
|
},
|
|
})
|