vue.config.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. // 双页面配置
  6. // pages: {
  7. // index: 'src/views/index/main.js',
  8. // },
  9. configureWebpack: config => {
  10. Object.assign(config, {
  11. // 开发生产共同配置
  12. resolve: {
  13. alias: {
  14. '@': path.resolve(__dirname, './src'),
  15. '@c': path.resolve(__dirname, './src/components'),
  16. '@a': path.resolve(__dirname, './src/assets'),
  17. '@publics': publics,
  18. },
  19. },
  20. });
  21. },
  22. devServer: {
  23. port: '8001',
  24. //api地址前缀
  25. proxy: {
  26. '/api': {
  27. target: 'http://smart.cc-lotus.info',
  28. ws: true,
  29. onProxyReq(proxyReq, req, res) {
  30. proxyReq.setHeader('x-tenant', 'master');
  31. },
  32. },
  33. '/files': {
  34. target: 'http://smart.cc-lotus.info',
  35. changeOrigin: true,
  36. ws: true,
  37. },
  38. '/weixin': {
  39. target: 'http://smart.cc-lotus.info',
  40. changeOrigin: true,
  41. ws: true,
  42. },
  43. '/test': {
  44. target: 'http://10.16.11.186:8103',
  45. ws: true,
  46. pathRewrite: {
  47. '^/test': '/api',
  48. },
  49. },
  50. },
  51. },
  52. };