vue.config.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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" ? "/" : "/wanda-adm/",
  8. // TODO:打包名称
  9. outputDir: "wanda-adm",
  10. configureWebpack: {
  11. // module: {
  12. // rules: [{
  13. // test: /\.(ttf|otf|eot|woff|woff2)$/,
  14. // use: {
  15. // loader: "file-loader",
  16. // options: {
  17. // name: " fonts/[name].[ext]",
  18. // },
  19. // },
  20. // },
  21. // {
  22. // test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
  23. // loader: 'url-loader',
  24. // options: {
  25. // limit: 10000,
  26. // name: ('fonts/[name].[ext]')
  27. // }
  28. // }]
  29. // }
  30. },
  31. //TODO: eslint 是否在保存时检查
  32. // assetsDir:'/',
  33. lintOnSave: process.env.NODE_ENV === "development",
  34. productionSourceMap: true,
  35. devServer: {
  36. port: devServerPort,
  37. open: true,
  38. overlay: {
  39. warning: false,
  40. errors: true
  41. },
  42. progress: false,
  43. proxy: {
  44. [process.env.VUE_APP_BASE_API]: {
  45. target: `http://127.0.0.1:${ stageServerPort }/mock-api/v1`,
  46. changeOrigin: true, // needed for virtual hosted sites
  47. ws: true, // proxy websockets
  48. pathRewrite: {
  49. ["^" + process.env.VUE_APP_BASE_API]: ""
  50. }
  51. },
  52. "/datacenter": {
  53. // target: "http://192.168.64.17:28890",
  54. target: "http://192.168.0.72:8080",
  55. changeOrigin: true
  56. },
  57. "/equip-component": {
  58. // target: "http://192.168.64.17:28890",
  59. target: "http://192.168.0.72:8080",
  60. changeOrigin: true
  61. },
  62. "/schedulerapi": {
  63. // target: "http://192.168.64.17:28890",
  64. target: "http://192.168.0.72:8080",
  65. changeOrigin: true,
  66. pathRewrite: {
  67. "^/schedulerapi": "/scheduler"
  68. }
  69. },
  70. "/modelapi": {
  71. // target: "http://192.168.64.17:28890",
  72. target: "http://192.168.0.72:8080",
  73. changeOrigin: true,
  74. pathRewrite: {
  75. "^/modelapi": "/revit-algorithm"
  76. }
  77. },
  78. // "/modelapi": {
  79. // target: "http://192.168.0.55:8080",
  80. // changeOrigin: true,
  81. // pathRewrite: {
  82. // "^/modelapi": "/"
  83. // }
  84. // },
  85. "/message-center": {
  86. // target: "http://192.168.64.17:28890",
  87. target: "http://192.168.0.72:8080",
  88. changeOrigin: true
  89. },
  90. "/rwd": {
  91. target: "http://39.102.40.239:9970",
  92. changeOrigin: true
  93. },
  94. "/image-service": {
  95. target: "http://39.97.179.199:8891",
  96. changeOrigin: true
  97. }
  98. }
  99. },
  100. //配置插件
  101. pluginOptions: {
  102. "style-resources-loader": {
  103. preProcessor: "scss",
  104. // sourceMap: true,
  105. patterns: [
  106. path.resolve(__dirname, "src/styles/_variables.scss"),
  107. path.resolve(__dirname, "src/styles/_mixins.scss")
  108. ]
  109. }
  110. },
  111. // 高级配置
  112. chainWebpack(config) {
  113. // config.module
  114. // .rule("fonts")
  115. // .test(/\.(ttf|otf|eot|woff|woff2)$/)
  116. // .use("file-loader")
  117. // .loader("file-loader")
  118. // .tap(options => {
  119. // options = {
  120. // // limit: 10000,
  121. // name: 'fonts/[name].[ext]',
  122. // }
  123. // return options
  124. // })
  125. // .end()
  126. //在html网页包插件的选项列表中提供应用程序的标题,以便
  127. //可以在中访问索引.html插入正确的标题。
  128. // https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-plugin
  129. config.plugin("html").tap(args => {
  130. args[0].title = name;
  131. return args;
  132. });
  133. }
  134. };