index.js 5.4 KB

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