index.js 7.2 KB

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