import { defineConfig } from 'vite'; import vue from '@vitejs/plugin-vue'; import qiankun from 'vite-plugin-qiankun'; import { viteExternalsPlugin } from 'vite-plugin-externals'; // useDevMode 开启时与热更新插件冲突,使用变量切换 const useDevMode = true; // https://vitejs.dev/config/ export default defineConfig({ plugins: [ vue(), viteExternalsPlugin({ jquery: 'jquery', moment: 'moment', gantt: 'gantt', // 支持值链式取值,会转换成 window['jquery']['jgrid'] //jgrid: ['jQuery', 'jgrid'] }), qiankun('client-trace-v3', { useDevMode, }), ], //base: './', base: 'http://127.0.0.1:8091/', resolve: { extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json'], //alias: [{ find: '@/', replacement: '/src/' }], }, // build: { // target: "esnext", // lib: { // name: `client-eam-v3-[name]`, // entry: path.resolve(__dirname, "src/main.js"), // formats: ["umd"], // }, // }, server: { port: 8091, host: 'localhost', open: '/', headers: { 'Access-Control-Allow-Origin': '*', }, proxy: { '/api': { target: 'http://localhost:83/', ws: false, changeOrigin: true, }, '/authApi': { target: 'http://localhost:83/', ws: false, changeOrigin: true, }, '/Dictionary': { target: 'http://localhost:83/', ws: false, changeOrigin: true, }, '/Files': { target: 'http://localhost:83/', ws: false, changeOrigin: true, }, '/WebSocket': { target: 'http://localhost:83/', ws: true, changeOrigin: true, }, }, }, });