index.js 5.3 KB

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