index.js 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. "use strict";
  2. // Template version: 1.3.1
  3. // see http://vuejs-templates.github.io/webpack for documentation.
  4. const path = require("path");
  5. const pathSrc = path.resolve(__dirname, "../src");
  6. let proxyTable = {
  7. "/icore.icp.web/pass/v1/sysusers/user/token": {
  8. //https://portal.steerinfo.com/icore.icp.web/pass/sso/v1/sysusers/user/token
  9. //target: 'https://portal-dev.steerinfo.com/icore.icp.web/pass/sso/v1/sysusers/user/token',
  10. target: "http://172.16.33.166:9001/v1/sysusers/user/token",
  11. changeOrigin: true,
  12. pathRewrite: {
  13. "^/icore.icp.web/pass/v1/sysusers/user/token": "/"
  14. }
  15. },
  16. "/icore.icp.web/pass/v1": {
  17. //target: 'http://172.16.33.161:80/v1', //加http
  18. target: "http://172.16.33.166:9001/v1",
  19. changeOrigin: true,
  20. pathRewrite: {
  21. "^/icore.icp.web/pass/v1": "/" //这里理解成用‘/api’代替target里面的地址,组件中我们调接口时直接用/api代替
  22. // 比如我要调用'http://0.0:300/user/add',直接写‘/api/user/add’即可 代理后地址栏显示/
  23. }
  24. },
  25. "/icore.icp.web/pass/auth/login": {
  26. //target: 'http://sso-dev.steerinfo.com/icore.icp.web/pass/auth/login',
  27. target: "http://172.16.33.166:9001/auth/login",
  28. changeOrigin: true,
  29. pathRewrite: {
  30. "^/icore.icp.web/pass/auth/login": ""
  31. }
  32. },
  33. "/icore-api/v1": {
  34. target: "http://172.16.33.161:8088/api/v1/truckTms",
  35. // target: "http://localhost:8080",
  36. // target: "http://192.168.1.109:8080",
  37. ws: true,
  38. pathRewrite: {
  39. "^/icore-api/v1": ""
  40. }
  41. },
  42. "/icore-api": {
  43. target: "http://172.16.33.166:9001",
  44. changeOrigin: true,
  45. pathRewrite: {
  46. "^/icore-api": "/"
  47. }
  48. },
  49. "/icore.icp.web/pass/act": {
  50. target: "http://172.16.33.166:8095",
  51. changeOrigin: true,
  52. pathRewrite: {
  53. "^/icore.icp.web/pass/act": "/"
  54. }
  55. },
  56. // 表格表单请求的域名地址
  57. "/api/v1/cd": {
  58. target: "http://172.16.33.161:8083",
  59. ws: true,
  60. pathRewrite: {
  61. "^/api/v1/cd": "/api/v1/cd"
  62. }
  63. },
  64. //抽奖结果的接口
  65. "/icore.icp.web/game/v1": {
  66. target: "http://172.16.33.166:9002",
  67. ws: true,
  68. pathRewrite: {
  69. "^/icore.icp.web/game/v1": "/v1"
  70. }
  71. },
  72. // 所有数据的请求域名地址
  73. // http://localhost:8802/api/v1/tms/getAllEnFactoryResult?apiId=143&orderType=5&pageNum=1&pageSize=10
  74. // http://172.16.33.161:8088/api/v1/truckTms/sysusertablecfgs/?userId=admin&userCode=admin&companyId=713710108567277568&uiId=metaData_appManagement_appSysTable&icore_t=1658973823958
  75. // http://localhost:8802/icore-api/v1/sysusertablecfgs/?userId=923674253012897792&userCode=admin06&companyId=713710108567277568&uiId=systemConfig_userManage_table&icore_t=1659347371501
  76. "/api/v1": {
  77. target: "http://172.16.33.166:80",
  78. // target: "http://localhost:8080",
  79. // target: "http://192.168.1.101:8080",
  80. ws: true,
  81. pathRewrite: {
  82. "^/api/v1": "/api/v1"
  83. }
  84. },
  85. "/views/api/v1": {
  86. //target: "http://172.16.33.166:80",
  87. target: "http://172.16.33.166:80",
  88. // target: "http://192.168.1.109:8080",
  89. ws: true,
  90. pathRewrite: {
  91. "^/views/api/v1": "/api/v1"
  92. }
  93. },
  94. "/icore.icp.web/pass/logout": {
  95. target: "http://172.16.33.166:9001/logout",
  96. changeOrigin: true,
  97. pathRewrite: {
  98. "^/icore.icp.web/pass/logout": "/"
  99. }
  100. }
  101. };
  102. let dist = "../dist";
  103. if (pathSrc.indexOf("node_modules") > -1) {
  104. dist = "../../../dist";
  105. let proxyTableGet = require("../../../cors.js").proxyTable;
  106. for (let i in proxyTableGet) {
  107. proxyTable[i] = proxyTableGet[i];
  108. }
  109. }
  110. module.exports = {
  111. dev: {
  112. // Paths
  113. assetsSubDirectory: "static",
  114. assetsPublicPath: "/",
  115. proxyTable: proxyTable,
  116. // Various Dev Server settings
  117. host: "localhost", // can be overwritten by process.env.HOST
  118. port: 8802, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
  119. autoOpenBrowser: false,
  120. errorOverlay: true,
  121. notifyOnErrors: true,
  122. poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
  123. // Use Eslint Loader?
  124. // If true, your code will be linted during bundling and
  125. // linting errors and warnings will be shown in the console.
  126. useEslint: true,
  127. // If true, eslint errors and warnings will also be shown in the error overlay
  128. // in the browser.
  129. showEslintErrorsInOverlay: false,
  130. /**
  131. * Source Maps
  132. */
  133. // https://webpack.js.org/configuration/devtool/#development
  134. // devtool: 'cheap-module-eval-source-map',
  135. // If you have problems debugging vue-files in devtools,
  136. // set this to false - it *may* help
  137. // https://vue-loader.vuejs.org/en/options.html#cachebusting
  138. cacheBusting: true,
  139. cssSourceMap: true
  140. },
  141. css: {
  142. loaderOptions: {
  143. sass: {
  144. prependData: '\n @import "@/styles/variables.scss";\n '
  145. }
  146. }
  147. },
  148. build: {
  149. // Template for index.html
  150. index: path.resolve(__dirname, dist + "/index.html"),
  151. // Paths
  152. assetsRoot: path.resolve(__dirname, dist),
  153. assetsSubDirectory: "static", // 打包后 static放的位置
  154. assetsPublicPath: "../", // html中webpack打包的JS -> ../static/xxx.js
  155. /**
  156. * Source Maps
  157. */
  158. productionSourceMap: false,
  159. // https: //webpack.js.org/configuration/devtool/#production
  160. devtool: "#source-map",
  161. // Gzip off by default as many popular static hosts such as
  162. // Surge or Netlify already gzip all static assets for you.
  163. // Before setting to `true`, make sure to:
  164. // npm install --save-dev compression-webpack-plugin
  165. productionGzip: false,
  166. productionGzipExtensions: ["js", "css"],
  167. // Run the build command with an extra argument to
  168. // View the bundle analyzer report after build finishes:
  169. // `npm run build --report`
  170. // Set to `true` or `false` to always turn it on or off
  171. bundleAnalyzerReport: process.env.npm_config_report
  172. }
  173. };