vue.config.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. const path = require("path");
  2. const name = "wanda-adm";
  3. const devServerPort = 28888;
  4. const stageServerPort = 28889;
  5. module.exports = {
  6. // TODO: 更改 publicPath 打包静态文件目录的配置
  7. publicPath: process.env.NODE_ENV === "production" ? "/" : "/",
  8. // TODO:打包名称
  9. outputDir: "wanda-adm",
  10. //TODO: eslint 是否在保存时检查
  11. lintOnSave: process.env.NODE_ENV === "development",
  12. productionSourceMap: false,
  13. devServer: {
  14. port: devServerPort,
  15. open: true,
  16. overlay: {
  17. warning: false,
  18. errors: true
  19. },
  20. progress: false,
  21. proxy: {
  22. [process.env.VUE_APP_BASE_API]: {
  23. target: `http://127.0.0.1:${stageServerPort}/mock-api/v1`,
  24. changeOrigin: true, // needed for virtual hosted sites
  25. ws: true, // proxy websockets
  26. pathRewrite: {
  27. ["^" + process.env.VUE_APP_BASE_API]: ""
  28. }
  29. },
  30. "/datacenter": {
  31. target: "http://192.168.64.17:28890",
  32. changeOrigin: true
  33. },
  34. "/equip-component": {
  35. target: "http://192.168.64.17:28890",
  36. changeOrigin: true
  37. },
  38. "/schedulerapi": {
  39. target: "http://192.168.64.17:28890",
  40. changeOrigin: true,
  41. pathRewrite: {
  42. "^/schedulerapi": "/scheduler"
  43. }
  44. },
  45. "/modelapi": {
  46. target: "http://192.168.64.17:28890",
  47. changeOrigin: true,
  48. pathRewrite: {
  49. "^/modelapi": "/revit-algorithm"
  50. }
  51. },
  52. // "/modelapi": {
  53. // target: "http://192.168.0.55:8080",
  54. // changeOrigin: true,
  55. // pathRewrite: {
  56. // "^/modelapi": "/"
  57. // }
  58. // },
  59. "/message-center": {
  60. target: "http://192.168.64.17:28890",
  61. changeOrigin: true
  62. },
  63. "/rwd": {
  64. target: "http://39.102.40.239:9970",
  65. changeOrigin: true
  66. },
  67. "/image-service": {
  68. target: "http://39.97.179.199:8891",
  69. changeOrigin: true
  70. }
  71. }
  72. },
  73. //配置插件
  74. pluginOptions: {
  75. "style-resources-loader": {
  76. preProcessor: "scss",
  77. patterns: [
  78. path.resolve(__dirname, "src/styles/_variables.scss"),
  79. path.resolve(__dirname, "src/styles/_mixins.scss")
  80. ]
  81. }
  82. },
  83. // 高级配置
  84. chainWebpack(config) {
  85. //在html网页包插件的选项列表中提供应用程序的标题,以便
  86. //可以在中访问索引.html插入正确的标题。
  87. // https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-plugin
  88. config.plugin("html").tap(args => {
  89. args[0].title = name;
  90. return args;
  91. });
  92. }
  93. };