MeterSphere/frontend/config/vite.config.dev.ts

81 lines
2.5 KiB
TypeScript
Raw Normal View History

import baseConfig from './vite.config.base';
2024-06-14 17:55:37 +08:00
import dotenv from 'dotenv';
2023-05-24 11:08:08 +08:00
import { mergeConfig } from 'vite';
import eslint from 'vite-plugin-eslint';
2024-06-14 17:55:37 +08:00
// 注入本地/开发配置环境变量(先导入的配置优先级高)
dotenv.config({ path: ['.env.development.local', '.env.development'] });
2023-05-24 11:08:08 +08:00
export default mergeConfig(
{
mode: 'development',
server: {
open: true,
fs: {
strict: true,
},
2023-06-02 15:18:59 +08:00
proxy: {
'/ws': {
2024-06-14 17:55:37 +08:00
target: process.env.VITE_DEV_DOMAIN,
changeOrigin: true,
rewrite: (path: string) => path.replace(/^\/front\/ws/, ''),
ws: true,
},
2023-08-08 16:49:49 +08:00
'/front': {
2024-06-14 17:55:37 +08:00
target: process.env.VITE_DEV_DOMAIN,
2023-06-02 15:18:59 +08:00
changeOrigin: true,
2023-08-08 16:49:49 +08:00
rewrite: (path: string) => path.replace(/^\/front/, ''),
2023-06-02 15:18:59 +08:00
},
'/file': {
2024-06-14 17:55:37 +08:00
target: process.env.VITE_DEV_DOMAIN,
changeOrigin: true,
rewrite: (path: string) => path.replace(/^\/front\/file/, ''),
},
'/attachment': {
2024-06-14 17:55:37 +08:00
target: process.env.VITE_DEV_DOMAIN,
changeOrigin: true,
rewrite: (path: string) => path.replace(/^\/front\/attachment/, ''),
},
'/bug/attachment': {
2024-06-14 17:55:37 +08:00
target: process.env.VITE_DEV_DOMAIN,
changeOrigin: true,
rewrite: (path: string) => path.replace(/^\/front\/bug\/attachment/, ''),
},
'/test-plan/report': {
target: process.env.VITE_DEV_DOMAIN,
changeOrigin: true,
rewrite: (path: string) => path.replace(/^\/front\/test-plan\/report/, ''),
},
2024-08-01 14:07:10 +08:00
'/organization': {
target: process.env.VITE_DEV_DOMAIN,
changeOrigin: true,
rewrite: (path: string) => path.replace(/^\/front\/organization/, ''),
},
'/project': {
target: process.env.VITE_DEV_DOMAIN,
changeOrigin: true,
rewrite: (path: string) => path.replace(/^\/front\/project/, ''),
},
'/plugin/image': {
2024-06-14 17:55:37 +08:00
target: process.env.VITE_DEV_DOMAIN,
changeOrigin: true,
rewrite: (path: string) => path.replace(/^\/front\/plugin\/image/, ''),
},
'/base-display': {
2024-06-14 17:55:37 +08:00
target: process.env.VITE_DEV_DOMAIN,
changeOrigin: true,
rewrite: (path: string) => path.replace(/^\/front\/base-display/, ''),
},
2023-06-02 15:18:59 +08:00
},
2023-05-24 11:08:08 +08:00
},
plugins: [
eslint({
cache: false,
include: ['src/**/*.ts', 'src/**/*.tsx', 'src/**/*.vue'],
exclude: ['node_modules'],
}),
],
},
baseConfig
);