vue.config.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. onProxyReq(proxyReq, req, res) {
  26. proxyReq.setHeader('x-tenant', '99991');
  27. },
  28. },
  29. '/test': {
  30. target: 'http://10.16.11.186:8103',
  31. ws: true,
  32. pathRewrite: {
  33. '^/test': '/api',
  34. },
  35. },
  36. '/ws': {
  37. target: 'http://smart.cc-lotus.info',
  38. ws: true,
  39. },
  40. '/weixin': {
  41. target: 'http://smart.cc-lotus.info',
  42. changeOrigin: true,
  43. ws: true,
  44. },
  45. '/files': {
  46. target: 'http://smart.cc-lotus.info',
  47. changeOrigin: true,
  48. ws: true,
  49. },
  50. '/adminapi': {
  51. target: 'http://smart.cc-lotus.info',
  52. ws: true,
  53. pathRewrite: { '^/adminapi': '/api' },
  54. onProxyReq(proxyReq, req, res) {
  55. proxyReq.setHeader('x-tenant', '99991');
  56. },
  57. },
  58. },
  59. },
  60. };