2022-09-14 10:03:28 +00:00
|
|
|
import { fileURLToPath, URL } from 'node:url'
|
2022-09-11 10:34:18 +00:00
|
|
|
|
2022-09-14 10:03:28 +00:00
|
|
|
import { defineConfig } from 'vite'
|
|
|
|
import vue from '@vitejs/plugin-vue'
|
|
|
|
import Components from 'unplugin-vue-components/vite'
|
|
|
|
import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers'
|
2022-09-11 10:34:18 +00:00
|
|
|
|
|
|
|
// https://vitejs.dev/config/
|
|
|
|
export default defineConfig({
|
2022-09-13 08:53:31 +00:00
|
|
|
plugins: [
|
|
|
|
vue(),
|
|
|
|
Components({
|
2022-09-14 10:03:28 +00:00
|
|
|
resolvers: [AntDesignVueResolver()]
|
|
|
|
})
|
2022-09-13 08:53:31 +00:00
|
|
|
],
|
2022-09-11 10:34:18 +00:00
|
|
|
resolve: {
|
|
|
|
alias: {
|
2022-09-14 10:03:28 +00:00
|
|
|
'@': fileURLToPath(new URL('./src', import.meta.url))
|
|
|
|
}
|
2022-09-11 10:34:18 +00:00
|
|
|
},
|
2022-09-13 08:53:31 +00:00
|
|
|
server: {
|
|
|
|
proxy: {
|
|
|
|
// 代理
|
2022-09-14 10:03:28 +00:00
|
|
|
'/api': {
|
|
|
|
target: 'http://localhost:8000',
|
2022-09-11 10:34:18 +00:00
|
|
|
changeOrigin: true,
|
2022-09-14 10:03:28 +00:00
|
|
|
rewrite: (path) => path.replace(/^\/api/, '')
|
2022-09-11 10:34:18 +00:00
|
|
|
},
|
2022-09-16 17:10:33 +00:00
|
|
|
'/socket': {
|
|
|
|
target: 'ws://localhost:8000/ws',
|
2022-09-14 10:03:28 +00:00
|
|
|
ws: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|