index.js 6.2 KB

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