vite.config.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. headers: {
  40. 'Access-Control-Allow-Origin': '*',
  41. },
  42. proxy: {
  43. '/api': {
  44. target: 'http://localhost:83/',
  45. ws: false,
  46. changeOrigin: true,
  47. },
  48. '/authApi': {
  49. target: 'http://localhost:83/',
  50. ws: false,
  51. changeOrigin: true,
  52. },
  53. '/Dictionary': {
  54. target: 'http://localhost:83/',
  55. ws: false,
  56. changeOrigin: true,
  57. },
  58. '/Files': {
  59. target: 'http://localhost:83/',
  60. ws: false,
  61. changeOrigin: true,
  62. },
  63. '/WebSocket': {
  64. target: 'http://localhost:83/',
  65. ws: true,
  66. changeOrigin: true,
  67. },
  68. },
  69. },
  70. });