import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import path from 'path' import eslintPlugin from 'vite-plugin-eslint' import { createSvgIconsPlugin } from 'vite-plugin-svg-icons' // https://vitejs.dev/config/ export default defineConfig({ server: { host: '0.0.0.0', port: 6600, // open: true proxy: { '/query': { target: 'http://192.168.2.7:5088', changeOrigin: true, rewrite: (path) => path }, '/history': { target: 'http://192.168.2.7:5089', changeOrigin: true, rewrite: (path) => path }, '/restart': { target: 'http://192.168.2.7:5089', changeOrigin: true, rewrite: (path) => path }, '/upload': { target: 'http://192.168.2.7:5088', changeOrigin: true, rewrite: (path) => path } } }, plugins: [ vue(), createSvgIconsPlugin({ // 指定需要缓存的图标文件夹 iconDirs: [ path.resolve(process.cwd(), 'src/assets/svg') ], // 指定symbolId格式 symbolId: 'icon-[dir]-[name]' }), eslintPlugin( { include: [ 'src/**/*.js', 'src/**/*.vue', 'src/**/*.ts' ], // 指定需要检查的文件 exclude: [ 'node_modules/**', 'dist/**' ], // 指定不需要检查的文件 fix: true, // 是否自动修复 cache: false // 是否启用缓存 } ) ], resolve: { // 设置路径别名 alias: { '@': path.resolve(__dirname, 'src') } }, build: { outDir: 'trawler' }, css: { preprocessorOptions: { scss: { api: 'modern' // 'modern-compiler' or 'modern' } } } })