index.js 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. 'use strict'
  2. // Template version: 1.2.4
  3. // see http://vuejs-templates.github.io/webpack for documentation.
  4. const path = require('path')
  5. const argv = require('yargs').argv
  6. // 获取环境变量
  7. const project = argv.define;
  8. process.stdout.write('===attention=== 当前项目:' + project + '\n\n')
  9. const devEnvConfig = require('./' + project + '/dev.env.js')
  10. const prodEnvConfig = require('./' + project + '/prod.env.js')
  11. module.exports = {
  12. dev: {
  13. // Paths
  14. assetsSubDirectory: 'static',
  15. assetsPublicPath: '/',
  16. proxyTable: {
  17. "/crm400": {
  18. target: devEnvConfig.findAddr(JSON.parse(devEnvConfig.hostConfig), 'crm400'),
  19. secure: false,
  20. changeOrigin: true,
  21. pathRewrite: {
  22. '^/crm400': '/'
  23. }
  24. },
  25. "/walter": {
  26. target: devEnvConfig.findAddr(JSON.parse(devEnvConfig.hostConfig), 'walter'),
  27. secure: false,
  28. changeOrigin: true,
  29. pathRewrite: {
  30. '^/walter': '/'
  31. }
  32. },
  33. "/club": {
  34. target: devEnvConfig.findAddr(JSON.parse(devEnvConfig.hostConfig), 'club'),
  35. secure: false,
  36. changeOrigin: true,
  37. pathRewrite: {
  38. '^/club': '/'
  39. }
  40. },
  41. "/houserkeep": {
  42. target: devEnvConfig.findAddr(JSON.parse(devEnvConfig.hostConfig), 'houserkeep'),
  43. secure: false,
  44. changeOrigin: true,
  45. pathRewrite: {
  46. '^/houserkeep': '/'
  47. }
  48. },
  49. "/activity": {
  50. target: devEnvConfig.findAddr(JSON.parse(devEnvConfig.hostConfig), 'activity'),
  51. secure: false,
  52. changeOrigin: true,
  53. pathRewrite: {
  54. '^/activity': '/'
  55. }
  56. },
  57. "/article": {
  58. target: devEnvConfig.findAddr(JSON.parse(devEnvConfig.hostConfig), 'article'),
  59. secure: false,
  60. changeOrigin: true,
  61. pathRewrite: {
  62. '^/article': '/'
  63. }
  64. },
  65. "/steward": {
  66. target: devEnvConfig.findAddr(JSON.parse(devEnvConfig.hostConfig), 'steward'),
  67. secure: false,
  68. changeOrigin: true,
  69. pathRewrite: {
  70. '^/steward': '/'
  71. }
  72. },
  73. "/question": { //问卷接口
  74. target: devEnvConfig.findAddr(JSON.parse(devEnvConfig.hostConfig), 'question'),
  75. secure: false,
  76. changeOrigin: true,
  77. pathRewrite: {
  78. '^/question': '/'
  79. }
  80. },
  81. "/charge": { //收费接口
  82. target: devEnvConfig.findAddr(JSON.parse(devEnvConfig.hostConfig), 'charge'),
  83. secure: false,
  84. changeOrigin: true,
  85. pathRewrite: {
  86. '^/charge': '/'
  87. }
  88. },
  89. "/activiti": {
  90. target: devEnvConfig.findAddr(JSON.parse(devEnvConfig.hostConfig), 'activiti'),
  91. secure: false,
  92. changeOrigin: true,
  93. pathRewrite: {
  94. '^/activiti': '/'
  95. },
  96. },
  97. "/decorationManage": {
  98. target: devEnvConfig.findAddr(JSON.parse(devEnvConfig.hostConfig), 'decorationManage'),
  99. secure: false,
  100. changeOrigin: true,
  101. pathRewrite: {
  102. '^/decorationManage': '/'
  103. },
  104. },
  105. "/itemPassport": {
  106. target: devEnvConfig.findAddr(JSON.parse(devEnvConfig.hostConfig), 'itemPassport'),
  107. secure: false,
  108. changeOrigin: true,
  109. pathRewrite: {
  110. '^/itemPassport': '/'
  111. },
  112. },
  113. "/itemHouse": {
  114. target: devEnvConfig.findAddr(JSON.parse(devEnvConfig.hostConfig), 'itemHouse'),
  115. secure: false,
  116. changeOrigin: true,
  117. pathRewrite: {
  118. '^/itemHouse': '/'
  119. },
  120. },
  121. "/qpi": {
  122. target: devEnvConfig.findAddr(JSON.parse(devEnvConfig.hostConfig), 'qpi'),
  123. secure: false,
  124. changeOrigin: true,
  125. pathRewrite: {
  126. '^/qpi': '/'
  127. },
  128. },
  129. "/datashow": { //深交所 - 管理视图
  130. target: devEnvConfig.findAddr(JSON.parse(devEnvConfig.hostConfig), 'datashow'),
  131. secure: false,
  132. changeOrigin: true,
  133. pathRewrite: {
  134. '^/datashow': '/'
  135. }
  136. },
  137. "/warning": { //深交所 - 预警
  138. target: devEnvConfig.findAddr(JSON.parse(devEnvConfig.hostConfig), 'warning'),
  139. secure: false,
  140. changeOrigin: true,
  141. pathRewrite: {
  142. '^/warning': '/'
  143. }
  144. },
  145. "/groupcontrol": { //深交所 - 会议管理
  146. target: devEnvConfig.findAddr(JSON.parse(devEnvConfig.hostConfig), 'groupcontrol'),
  147. secure: false,
  148. changeOrigin: true,
  149. pathRewrite: {
  150. '^/groupcontrol': '/'
  151. }
  152. },
  153. "/energy-charging": { //深交所 - 水电气表查询
  154. target: devEnvConfig.findAddr(JSON.parse(devEnvConfig.hostConfig), 'energyCharging'),
  155. secure: false,
  156. changeOrigin: true,
  157. pathRewrite: {
  158. '^/energy-charging': '/'
  159. }
  160. },
  161. "/wuyecrm": {
  162. target: devEnvConfig.findAddr(JSON.parse(devEnvConfig.hostConfig), 'wuyecrm'),
  163. secure: false,
  164. changeOrigin: true,
  165. pathRewrite: {
  166. '^/wuyecrm': '/'
  167. }
  168. },
  169. "/gf": {
  170. target: devEnvConfig.findAddr(JSON.parse(devEnvConfig.hostConfig), 'gf'),
  171. secure: false,
  172. changeOrigin: true,
  173. pathRewrite: {
  174. '^/gf': '/'
  175. }
  176. },
  177. "/filemanager": {
  178. target: devEnvConfig.findAddr(JSON.parse(devEnvConfig.hostConfig), 'filemanager'),
  179. secure: false,
  180. changeOrigin: true,
  181. pathRewrite: {
  182. '^/filemanager': '/'
  183. }
  184. },
  185. "/leasing": { //审批
  186. // target:devEnvConfig.findAddr(JSON.parse(devEnvConfig.hostConfig), 'leasing'),
  187. target: 'http://180.168.37.139/leasing',
  188. secure: false,
  189. changeOrigin: true,
  190. pathRewrite: {
  191. '^/leasing': '/'
  192. }
  193. },
  194. "/neikong": { //审批
  195. // target:devEnvConfig.findAddr(JSON.parse(devEnvConfig.hostConfig), 'neikong'),
  196. target: 'http://180.168.37.139/neikong',
  197. secure: false,
  198. changeOrigin: true,
  199. pathRewrite: {
  200. '^/neikong': '/'
  201. }
  202. },
  203. "/activiti": { //审批
  204. target: 'http://180.168.37.139/activiti',
  205. secure: false,
  206. changeOrigin: true,
  207. pathRewrite: {
  208. '^/activiti': '/'
  209. }
  210. },
  211. "/landcrm": { //审批 上传附件
  212. target: 'http://180.168.37.139/landcrm',
  213. secure: false,
  214. changeOrigin: true,
  215. pathRewrite: {
  216. '^/landcrm': '/'
  217. }
  218. },
  219. "/device": {
  220. target: devEnvConfig.findAddr(JSON.parse(devEnvConfig.hostConfig), 'device'),
  221. secure: false,
  222. changeOrigin: true,
  223. pathRewrite: {
  224. '^/device': '/'
  225. }
  226. },
  227. },
  228. env: devEnvConfig,
  229. // Various Dev Server settings
  230. host: '172.18.0.110', // can be overwritten by process.env.HOST
  231. port: 8082, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
  232. autoOpenBrowser: false,
  233. errorOverlay: true,
  234. notifyOnErrors: true,
  235. poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
  236. // Use Eslint Loader?
  237. // If true, your code will be linted during bundling and
  238. // linting errors and warnings will be shown in the console.
  239. useEslint: true,
  240. // If true, eslint errors and warnings will also be shown in the error overlay
  241. // in the browser.
  242. showEslintErrorsInOverlay: false,
  243. /**
  244. * Source Maps
  245. */
  246. // https://webpack.js.org/configuration/devtool/#development
  247. devtool: 'eval-source-map',
  248. // If you have problems debugging vue-files in devtools,
  249. // set this to false - it *may* help
  250. // https://vue-loader.vuejs.org/en/options.html#cachebusting
  251. cacheBusting: true,
  252. // CSS Sourcemaps off by default because relative paths are "buggy"
  253. // with this option, according to the CSS-Loader README
  254. // (https://github.com/webpack/css-loader#sourcemaps)
  255. // In our experience, they generally work as expected,
  256. // just be aware of this issue when enabling this option.
  257. cssSourceMap: false,
  258. },
  259. build: {
  260. env: prodEnvConfig,
  261. // Template for index.html
  262. index: path.resolve(__dirname, '../dist/index.html'),
  263. // Paths
  264. assetsRoot: path.resolve(__dirname, '../dist'),
  265. assetsSubDirectory: 'static',
  266. assetsPublicPath: './',
  267. /**
  268. * Source Maps
  269. */
  270. productionSourceMap: false,
  271. // https://webpack.js.org/configuration/devtool/#production
  272. // devtool: '#source-map',
  273. // Run the build command with an extra argument to
  274. // View the bundle analyzer report after build finishes:
  275. // `npm run build --report`
  276. // Set to `true` or `false` to always turn it on or off
  277. bundleAnalyzerReport: process.env.npm_config_report
  278. }
  279. }