vite.config.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. import { defineConfig } from 'vite';
  2. import vue from '@vitejs/plugin-vue';
  3. import qiankun from 'vite-plugin-qiankun';
  4. import { viteExternalsPlugin } from 'vite-plugin-externals';
  5. // useDevMode 开启时与热更新插件冲突,使用变量切换
  6. const useDevMode = true;
  7. // https://vitejs.dev/config/
  8. export default defineConfig({
  9. plugins: [
  10. vue(),
  11. viteExternalsPlugin({
  12. jquery: 'jquery',
  13. moment: 'moment',
  14. gantt: 'gantt',
  15. // 支持值链式取值,会转换成 window['jquery']['jgrid']
  16. //jgrid: ['jQuery', 'jgrid']
  17. }),
  18. qiankun('client-trace-v3', {
  19. useDevMode,
  20. }),
  21. ],
  22. //base: './',
  23. base: 'http://127.0.0.1:8091/',
  24. resolve: {
  25. extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json'],
  26. //alias: [{ find: '@/', replacement: '/src/' }],
  27. },
  28. // build: {
  29. // target: "esnext",
  30. // lib: {
  31. // name: `client-eam-v3-[name]`,
  32. // entry: path.resolve(__dirname, "src/main.js"),
  33. // formats: ["umd"],
  34. // },
  35. // },
  36. server: {
  37. port: 8091,
  38. host: 'localhost',
  39. open: '/',
  40. headers: {
  41. 'Access-Control-Allow-Origin': '*',
  42. },
  43. proxy: {
  44. '/api': {
  45. target: 'http://localhost:83/',
  46. ws: false,
  47. changeOrigin: true,
  48. },
  49. '/authApi': {
  50. target: 'http://localhost:83/',
  51. ws: false,
  52. changeOrigin: true,
  53. },
  54. '/Dictionary': {
  55. target: 'http://localhost:83/',
  56. ws: false,
  57. changeOrigin: true,
  58. },
  59. '/Files': {
  60. target: 'http://localhost:83/',
  61. ws: false,
  62. changeOrigin: true,
  63. },
  64. '/WebSocket': {
  65. target: 'http://localhost:83/',
  66. ws: true,
  67. changeOrigin: true,
  68. },
  69. },
  70. },
  71. });