index.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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": {
  34. target: "http://172.16.33.166:9001",
  35. changeOrigin: true,
  36. pathRewrite: {
  37. "^/icore-api": "/"
  38. }
  39. },
  40. "/icore.icp.web/pass/act": {
  41. target: "http://172.16.33.166:8095",
  42. changeOrigin: true,
  43. pathRewrite: {
  44. "^/icore.icp.web/pass/act": "/"
  45. }
  46. },
  47. // 表格表单请求的域名地址
  48. "/api/v1/cd": {
  49. target: "http://172.16.33.161:8083",
  50. ws: true,
  51. pathRewrite: {
  52. "^/api/v1/cd": "/api/v1/cd"
  53. }
  54. },
  55. //抽奖结果的接口
  56. "/icore.icp.web/game/v1": {
  57. target: "http://172.16.33.166:9002",
  58. ws: true,
  59. pathRewrite: {
  60. "^/icore.icp.web/game/v1": "/v1"
  61. }
  62. },
  63. // 所有数据的请求域名地址
  64. "/api/v1": {
  65. // target: "http://localhost:8080",
  66. // target: "http://172.16.33.166:80",
  67. target: "http://192.168.1.107:8080",
  68. // target: "http://192.168.1.106:8080",
  69. ws: true,
  70. pathRewrite: {
  71. "^/api/v1": "/api/v1"
  72. }
  73. },
  74. "/views/api/v1": {
  75. target: "http://172.16.33.166:80",
  76. // target: "http://192.168.1.109:8080",
  77. ws: true,
  78. pathRewrite: {
  79. "^/views/api/v1": "/api/v1"
  80. }
  81. },
  82. "/icore.icp.web/pass/logout": {
  83. target: "http://172.16.33.166:9001/logout",
  84. changeOrigin: true,
  85. pathRewrite: {
  86. "^/icore.icp.web/pass/logout": "/"
  87. }
  88. }
  89. };
  90. let dist = "../dist";
  91. if (pathSrc.indexOf("node_modules") > -1) {
  92. dist = "../../../dist";
  93. let proxyTableGet = require("../../../cors.js").proxyTable;
  94. for (let i in proxyTableGet) {
  95. proxyTable[i] = proxyTableGet[i];
  96. }
  97. }
  98. module.exports = {
  99. dev: {
  100. // Paths
  101. assetsSubDirectory: "static",
  102. assetsPublicPath: "/",
  103. proxyTable: proxyTable,
  104. // Various Dev Server settings
  105. host: "localhost", // can be overwritten by process.env.HOST
  106. port: 8802, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
  107. autoOpenBrowser: false,
  108. errorOverlay: true,
  109. notifyOnErrors: true,
  110. poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
  111. // Use Eslint Loader?
  112. // If true, your code will be linted during bundling and
  113. // linting errors and warnings will be shown in the console.
  114. useEslint: true,
  115. // If true, eslint errors and warnings will also be shown in the error overlay
  116. // in the browser.
  117. showEslintErrorsInOverlay: false,
  118. /**
  119. * Source Maps
  120. */
  121. // https://webpack.js.org/configuration/devtool/#development
  122. // devtool: 'cheap-module-eval-source-map',
  123. // If you have problems debugging vue-files in devtools,
  124. // set this to false - it *may* help
  125. // https://vue-loader.vuejs.org/en/options.html#cachebusting
  126. cacheBusting: true,
  127. cssSourceMap: true
  128. },
  129. css: {
  130. loaderOptions: {
  131. sass: {
  132. prependData: '\n @import "@/styles/variables.scss";\n '
  133. }
  134. }
  135. },
  136. build: {
  137. // Template for index.html
  138. index: path.resolve(__dirname, dist + "/index.html"),
  139. // Paths
  140. assetsRoot: path.resolve(__dirname, dist),
  141. assetsSubDirectory: "static", // 打包后 static放的位置
  142. assetsPublicPath: "../", // html中webpack打包的JS -> ../static/xxx.js
  143. /**
  144. * Source Maps
  145. */
  146. productionSourceMap: false,
  147. // https: //webpack.js.org/configuration/devtool/#production
  148. devtool: "#source-map",
  149. // Gzip off by default as many popular static hosts such as
  150. // Surge or Netlify already gzip all static assets for you.
  151. // Before setting to `true`, make sure to:
  152. // npm install --save-dev compression-webpack-plugin
  153. productionGzip: false,
  154. productionGzipExtensions: ["js", "css"],
  155. // Run the build command with an extra argument to
  156. // View the bundle analyzer report after build finishes:
  157. // `npm run build --report`
  158. // Set to `true` or `false` to always turn it on or off
  159. bundleAnalyzerReport: process.env.npm_config_report
  160. }
  161. };