123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- import { defineConfig, loadEnv } from 'vite'
- import path from 'path'
- import createVitePlugins from './vite/plugins'
- export default defineConfig(({ mode, command }) => {
- const env = loadEnv(mode, process.cwd())
- const { VITE_APP_ENV } = env
- return {
-
-
-
- base: '/backend/',
- plugins: createVitePlugins(env, command === 'build'),
- resolve: {
-
- alias: {
-
- '~': path.resolve(__dirname, './'),
-
- '@': path.resolve(__dirname, './src')
- },
-
- extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue']
- },
- build: {
- outDir: 'backend'
- },
-
- server: {
- port: 10,
- host: true,
- open: true,
- proxy: {
-
- '/dev-api': {
- target: 'http://localhost:8010',
- changeOrigin: true,
- rewrite: p => p.replace(/^\/dev-api/, '')
- },
- '/prod-api': {
- target: 'http://106.55.102.172:8010',
- changeOrigin: true,
- rewrite: p => p.replace(/^\/prod-api/, '')
- }
- }
- },
-
- css: {
- postcss: {
- plugins: [
- {
- postcssPlugin: 'internal:charset-removal',
- AtRule: {
- charset: atRule => {
- if (atRule.name === 'charset') {
- atRule.remove()
- }
- }
- }
- }
- ]
- }
- }
- }
- })
|