MicroFish/frontend/vite.config.js

40 lines
1010 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
// https://vite.dev/config/
export default defineConfig({
plugins: [vue()],
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
'@locales': path.resolve(__dirname, '../locales')
}
},
server: {
port: 3000,
open: true,
proxy: {
'/api': {
target: 'http://localhost:5001',
changeOrigin: true,
secure: false
}
}
},
// C1生产镜像用 `vite preview` 提供已构建的静态产物(而非开发服务器)。
// preview 默认不套用 server.proxy需单独声明否则 /api 不被转发到后端。
// host:'0.0.0.0' 必需:默认仅绑 localhost在容器内会让 Docker 端口映射3000:3000无法触达。
preview: {
host: '0.0.0.0',
port: 3000,
proxy: {
'/api': {
target: 'http://localhost:5001',
changeOrigin: true,
secure: false
}
}
}
})