vue.config.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. const path = require('path');
  2. const publics = path.resolve(__dirname, '../web-common');
  3. module.exports = {
  4. publicPath: process.env.NODE_ENV === 'development' ? '/' : process.env.VUE_APP_ROUTER,
  5. configureWebpack: config => {
  6. Object.assign(config, {
  7. // 开发生产共同配置
  8. resolve: {
  9. alias: {
  10. '@': path.resolve(__dirname, './src'),
  11. '@c': path.resolve(__dirname, './src/components'),
  12. '@a': path.resolve(__dirname, './src/assets'),
  13. '@publics': publics,
  14. },
  15. },
  16. });
  17. },
  18. devServer: {
  19. port: '8004',
  20. //api地址前缀
  21. proxy: {
  22. '/api': {
  23. target: 'http://smart.cc-lotus.info',
  24. ws: true,
  25. },
  26. '/bugInfo': {
  27. target: 'http://127.0.0.1:9001',
  28. ws: true,
  29. pathRewrite: {
  30. '^/bugInfo': '',
  31. },
  32. },
  33. '/ws': {
  34. target: 'http://smart.cc-lotus.info',
  35. ws: true,
  36. },
  37. '/weixin': {
  38. target: 'http://smart.cc-lotus.info',
  39. changeOrigin: true,
  40. ws: true,
  41. },
  42. '/files': {
  43. target: 'http://smart.cc-lotus.info',
  44. changeOrigin: true,
  45. ws: true,
  46. },
  47. '/adminapi': {
  48. target: 'http://10.16.5.15:8105',
  49. ws: true,
  50. pathRewrite: { '^/adminapi': '/api' },
  51. onProxyReq(proxyReq, req, res) {
  52. proxyReq.setHeader('x-tenant', '99991');
  53. },
  54. },
  55. },
  56. },
  57. };