index.js 6.8 KB

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