94 lines
2.6 KiB
JavaScript
94 lines
2.6 KiB
JavaScript
import { fileURLToPath, URL } from 'node:url'
|
|
import { defineConfig } from 'vite'
|
|
import AutoImport from 'unplugin-auto-import/vite'
|
|
import Components from 'unplugin-vue-components/vite'
|
|
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
|
|
import Icons from 'unplugin-icons/vite'
|
|
import IconsResolver from 'unplugin-icons/resolver'
|
|
import vue from '@vitejs/plugin-vue'
|
|
import Inspect from 'vite-plugin-inspect'
|
|
export default defineConfig({
|
|
plugins: [
|
|
vue(),
|
|
AutoImport({
|
|
//自动导入vue相关函数
|
|
imports: ['vue','vue-router'],
|
|
|
|
resolvers: [
|
|
ElementPlusResolver(),
|
|
//自动导入图标组件
|
|
IconsResolver({
|
|
prefix: 'Icon',
|
|
}),
|
|
],
|
|
}),
|
|
Components({
|
|
resolvers: [
|
|
// 自动注册图标组件
|
|
IconsResolver({
|
|
enabledCollections: ['ep'],
|
|
}),
|
|
//自动导入组件
|
|
ElementPlusResolver()
|
|
],
|
|
}),
|
|
Icons({
|
|
autoInstall: true,
|
|
}),
|
|
Inspect(),
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
'@': fileURLToPath(new URL('./src', import.meta.url))
|
|
}
|
|
},
|
|
build: {
|
|
minify: 'esbuild',
|
|
terserOptions: {
|
|
compress: {
|
|
drop_console: false, // 生产环境移除log
|
|
drop_debugger: false // 生产环境禁用debugger
|
|
}
|
|
}
|
|
},
|
|
server: {
|
|
host: '0.0.0.0',
|
|
port: 8888,
|
|
strictPort: false,
|
|
open: true,
|
|
proxy: {
|
|
// '/api/tunnel': {
|
|
// // // target: 'http://gateway.feashow.cn',
|
|
// // target: 'http://frp.feashow.cn:31800/',
|
|
// // target: 'http://clay.frp.feashow.cn',
|
|
// target: 'http://192.168.31.175:9020',
|
|
// changeOrigin: true,
|
|
// rewrite: (path) => path.replace(/^\/api\/tunnel/, ''),
|
|
// },
|
|
// '/api/admin': {
|
|
// // target: 'http://gateway.feashow.cn',
|
|
// target: 'http://192.168.31.175:8000',
|
|
// changeOrigin: true,
|
|
// rewrite: (path) => path.replace(/^\/api/, ''),
|
|
// },
|
|
'/api': {
|
|
target: 'http://tunnel.feashow.com/api',
|
|
// target: 'http://frp.toomewhy.top:38000',
|
|
changeOrigin: true,
|
|
rewrite: (path) => path.replace(/^\/api/, ''),
|
|
},
|
|
'/socket': {
|
|
target: 'ws://web-tunnel.feashow.com/api/notice-ws/notice',
|
|
ws: true
|
|
},
|
|
'/websocket': {
|
|
target: 'ws://tunnel.feashow.com/api/wstunnel/websocket/simulate',
|
|
// target: 'ws://192.168.31.175:9000/websocket/simulate',
|
|
changeOrigin: true,
|
|
ws: true,
|
|
rewrite: (path) => path.replace(/^\/websocket/, '')
|
|
}
|
|
}
|
|
}
|
|
})
|