index.js 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  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. "/api/v1/cd": {
  47. target: "http://172.16.33.166:8083",
  48. ws: true,
  49. pathRewrite: {
  50. "^/api/v1/cd": "/api/v1/cd"
  51. }
  52. },
  53. "/api/v1": {
  54. target: "http://172.16.33.166:8080",
  55. ws: true,
  56. pathRewrite: {
  57. "^/api/v1": "/api/v1"
  58. }
  59. },
  60. '/icore.icp.web/pass/logout': {
  61. target: 'http://172.16.33.161:9001/logout',
  62. changeOrigin: true,
  63. pathRewrite: {
  64. '^/icore.icp.web/pass/logout': '/'
  65. }
  66. },
  67. /**
  68. '/icore.icp.web/pass/configCenter': {
  69. target: 'http://paas-config/configCenter',
  70. changeOrigin: true,
  71. pathRewrite: {
  72. '^/icore.icp.web/pass/configCenter': '/'
  73. }
  74. },
  75. '/icore.icp.web/restPassword': {
  76. target: 'http://sso-dev.steerinfo.com',
  77. changeOrigin: true,
  78. pathRewrite: {
  79. '^/icore.icp.web/restPassword': '/'
  80. }
  81. },
  82. '/icore.icp.web/pass/serviceCenter': {
  83. target: 'http://dev-govern.steerinfo.com',
  84. changeOrigin: true,
  85. pathRewrite: {
  86. '^/icore.icp.web/pass/serviceCenter': '/'
  87. }
  88. },
  89. '/icore.icp.web/pass/act': {
  90. target: 'http://dev-act.steerinfo.com',
  91. changeOrigin: true,
  92. pathRewrite: {
  93. '^/icore.icp.web/pass/act': '/'
  94. }
  95. },
  96. '/icore.icp.web/pass/job': {
  97. target: 'http://dev-job.steerinfo.com',
  98. changeOrigin: true,
  99. pathRewrite: {
  100. '^/icore.icp.web/pass/job': '/'
  101. }
  102. },
  103. '/icore.icp.web/pass/dd': {
  104. target: 'http://dd.steerinfo.com',
  105. changeOrigin: true,
  106. pathRewrite: {
  107. '^/icore.icp.web/pass/dd': '/'
  108. }
  109. },
  110. '/icore.icp.web/pass/apiauth': {
  111. target: 'http://auth.steerinfo.com',
  112. changeOrigin: true,
  113. pathRewrite: {
  114. '^/icore.icp.web/pass/apiauth': '/'
  115. }
  116. },
  117. '/icore.icp.web/pass/websocket': {
  118. target: 'http://websocket.steerinfo.com/',
  119. changeOrigin: true,
  120. pathRewrite: {
  121. '^/icore.icp.web/pass/websocket': '/'
  122. }
  123. },
  124. '/icore-api': {
  125. target: 'http://sso-dev.steerinfo.com',
  126. changeOrigin: true,
  127. pathRewrite: {
  128. '^/icore-api': '/'
  129. }
  130. },
  131. '/pass/devops': {
  132. target: 'http://10.10.50.51:9080',
  133. changeOrigin: true,
  134. pathRewrite: {
  135. '^/pass/devops': '/'
  136. }
  137. },
  138. '/graphql': {
  139. // target: 'http://192.168.10.128:8080',
  140. target: 'http://10.10.50.28:8080',
  141. changeOrigin: true
  142. },
  143. '/devopsApi': {
  144. target: 'https://devops-api.steerinfo.com',
  145. changeOrigin: true,
  146. pathRewrite: {
  147. '^/devopsApi': '/'
  148. }
  149. },
  150. '/devops-images': {
  151. target: 'https://devops.steerinfo.com',
  152. changeOrigin: true
  153. },
  154. '/authManage': {
  155. target: 'http://10.10.50.62:20000',
  156. changeOrigin: true,
  157. pathRewrite: {
  158. '^/authManage': '/'
  159. }
  160. },
  161. '/icore.icp.web/edgeDevice': {
  162. target: 'http://10.10.50.62:10000',
  163. changeOrigin: true,
  164. pathRewrite: {
  165. '^/icore.icp.web/edgeDevice': '/'
  166. }
  167. }*/
  168. }
  169. let dist = '../dist';
  170. if (pathSrc.indexOf('node_modules') > -1) {
  171. dist = '../../../dist';
  172. let proxyTableGet = require('../../../cors.js').proxyTable;
  173. for (let i in proxyTableGet) {
  174. proxyTable[i] = proxyTableGet[i]
  175. }
  176. }
  177. module.exports = {
  178. dev: {
  179. // Paths
  180. assetsSubDirectory: 'static',
  181. assetsPublicPath: '/',
  182. proxyTable: proxyTable,
  183. // Various Dev Server settings
  184. host: 'localhost', // can be overwritten by process.env.HOST
  185. port: 8802, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
  186. autoOpenBrowser: false,
  187. errorOverlay: true,
  188. notifyOnErrors: true,
  189. poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
  190. // Use Eslint Loader?
  191. // If true, your code will be linted during bundling and
  192. // linting errors and warnings will be shown in the console.
  193. useEslint: true,
  194. // If true, eslint errors and warnings will also be shown in the error overlay
  195. // in the browser.
  196. showEslintErrorsInOverlay: false,
  197. /**
  198. * Source Maps
  199. */
  200. // https://webpack.js.org/configuration/devtool/#development
  201. // devtool: 'cheap-module-eval-source-map',
  202. // If you have problems debugging vue-files in devtools,
  203. // set this to false - it *may* help
  204. // https://vue-loader.vuejs.org/en/options.html#cachebusting
  205. cacheBusting: true,
  206. cssSourceMap: true
  207. },
  208. css: {
  209. loaderOptions: {
  210. sass: {
  211. prependData: '\n @import "@/styles/variables.scss";\n '
  212. }
  213. }
  214. },
  215. build: {
  216. // Template for index.html
  217. index: path.resolve(__dirname, dist + '/index.html'),
  218. // Paths
  219. assetsRoot: path.resolve(__dirname, dist),
  220. assetsSubDirectory: 'static', // 打包后 static放的位置
  221. assetsPublicPath: '../', // html中webpack打包的JS -> ../static/xxx.js
  222. /**
  223. * Source Maps
  224. */
  225. productionSourceMap: false,
  226. // https: //webpack.js.org/configuration/devtool/#production
  227. devtool: '#source-map',
  228. // Gzip off by default as many popular static hosts such as
  229. // Surge or Netlify already gzip all static assets for you.
  230. // Before setting to `true`, make sure to:
  231. // npm install --save-dev compression-webpack-plugin
  232. productionGzip: false,
  233. productionGzipExtensions: ['js', 'css'],
  234. // Run the build command with an extra argument to
  235. // View the bundle analyzer report after build finishes:
  236. // `npm run build --report`
  237. // Set to `true` or `false` to always turn it on or off
  238. bundleAnalyzerReport: process.env.npm_config_report
  239. }
  240. }