index.js 7.1 KB

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