2026-04-01 22:39:11 +08:00
|
|
|
import { defineConfig } from 'vite'
|
|
|
|
|
import vue from '@vitejs/plugin-vue'
|
|
|
|
|
import path from 'path'
|
2026-04-02 12:52:40 +08:00
|
|
|
import { fileURLToPath } from 'url'
|
|
|
|
|
import { dirname, resolve } from 'path'
|
|
|
|
|
|
|
|
|
|
const __dirname = dirname(fileURLToPath(import.meta.url))
|
2026-04-01 22:39:11 +08:00
|
|
|
|
|
|
|
|
export default defineConfig({
|
|
|
|
|
plugins: [vue()],
|
|
|
|
|
resolve: {
|
|
|
|
|
alias: {
|
|
|
|
|
'@': path.resolve(__dirname, 'src')
|
|
|
|
|
}
|
|
|
|
|
},
|
2026-04-02 12:52:40 +08:00
|
|
|
base: '/', // 绝对路径,打包后 HTML 引用 /assets/...
|
|
|
|
|
build: {
|
|
|
|
|
outDir: resolve(__dirname, '../src/main/resources/webapp'),
|
|
|
|
|
emptyOutDir: true
|
|
|
|
|
},
|
2026-04-01 22:39:11 +08:00
|
|
|
server: {
|
|
|
|
|
port: 5173,
|
|
|
|
|
proxy: {
|
|
|
|
|
'/api': {
|
2026-04-02 22:08:01 +08:00
|
|
|
target: 'http://localhost:18089',
|
2026-04-01 22:39:11 +08:00
|
|
|
changeOrigin: true
|
|
|
|
|
},
|
|
|
|
|
'/ws': {
|
2026-04-02 22:08:01 +08:00
|
|
|
target: 'ws://localhost:18089',
|
2026-04-01 22:39:11 +08:00
|
|
|
ws: true
|
|
|
|
|
},
|
|
|
|
|
'/uploads': {
|
2026-04-02 22:08:01 +08:00
|
|
|
target: 'http://localhost:18089',
|
2026-04-01 22:39:11 +08:00
|
|
|
changeOrigin: true
|
|
|
|
|
},
|
|
|
|
|
'/files': {
|
2026-04-02 22:08:01 +08:00
|
|
|
target: 'http://localhost:18089',
|
2026-04-01 22:39:11 +08:00
|
|
|
changeOrigin: true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|