import vue from '@vitejs/plugin-vue'
|
|
import { defineConfig, loadEnv } from 'vite';
|
|
import path from 'path';
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig(({ command, mode }) => {
|
|
const env = loadEnv(mode, process.cwd());
|
|
return {
|
|
plugins: [vue()],
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, 'src')
|
|
}
|
|
},
|
|
server: {
|
|
host: '0.0.0.0',
|
|
port: env.VITE_APP_PORT ? Number(env.VITE_APP_PORT) : 3000,
|
|
open: true,
|
|
proxy: {
|
|
[env.VITE_APP_BASE_API]: {
|
|
target: 'http://localhost:8080',
|
|
changeOrigin: true,
|
|
ws: true,
|
|
rewrite: (path) => path.replace(new RegExp('^' + env.VITE_APP_BASE_API), '')
|
|
}
|
|
}
|
|
},
|
|
}
|
|
})
|