|
|
@ -2,19 +2,24 @@ import { resolve } from 'node:path' |
|
|
|
import vue from '@vitejs/plugin-vue' |
|
|
|
import AutoImport from 'unplugin-auto-import/vite' |
|
|
|
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers' |
|
|
|
import { defineConfig } from 'vite' |
|
|
|
import { defineConfig, loadEnv } from 'vite' |
|
|
|
import viteCompression from 'vite-plugin-compression' |
|
|
|
import eslintPlugin from 'vite-plugin-eslint' |
|
|
|
import packageJson from './package.json' |
|
|
|
|
|
|
|
const Timestamp = new Date().getTime() |
|
|
|
export default defineConfig({ |
|
|
|
|
|
|
|
export default defineConfig(({ mode }) => { |
|
|
|
// eslint-disable-next-line node/prefer-global/process
|
|
|
|
const env = loadEnv(mode, process.cwd(), 'FT_') |
|
|
|
return { |
|
|
|
define: { |
|
|
|
__APP_VERSION__: JSON.stringify(packageJson.version), |
|
|
|
}, |
|
|
|
base: './', |
|
|
|
envPrefix: 'FT_', |
|
|
|
esbuild: { |
|
|
|
// eslint-disable-next-line node/prefer-global/process
|
|
|
|
drop: process.env.NODE_ENV === 'production' ? ['console'] : [], |
|
|
|
}, |
|
|
|
build: { |
|
|
@ -83,13 +88,13 @@ export default defineConfig({ |
|
|
|
port: 3000, |
|
|
|
host: '0.0.0.0', |
|
|
|
proxy: { |
|
|
|
'/api': { |
|
|
|
target: '192.168.100.168:8080', |
|
|
|
// target: 'http://192.168.1.200:8080',
|
|
|
|
[env.FT_API_BASE]: { |
|
|
|
target: env.FT_PROXY, |
|
|
|
// secure: false,
|
|
|
|
changeOrigin: true, // 是否跨域
|
|
|
|
rewrite: path => path.replace(/^\/api/, 'api'), |
|
|
|
rewrite: path => path.replace(new RegExp(`^${env.FT_API_BASE}`), 'api'), |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
} |
|
|
|
}) |