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

67 lines
2.0 KiB
TypeScript
Raw Normal View History

2023-05-24 11:08:08 +08:00
/// <reference types="vitest" />
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/, ''),
},
'/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
);