webpack.config.js 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. const path = require("path");
  2. const webpack = require("webpack");
  3. const CleanWebpackPlugin = require("clean-webpack-plugin");
  4. const ContextReplacementPlugin = require("webpack/lib/ContextReplacementPlugin");
  5. const CopyWebpackPlugin = require("copy-webpack-plugin");
  6. module.exports = {
  7. entry: {
  8. main: "src/portal.js"
  9. },
  10. output: {
  11. filename: "[name].js",
  12. path: path.resolve(__dirname, "dist")
  13. },
  14. module: {
  15. rules: [
  16. {
  17. test: /\.js?$/,
  18. exclude: [path.resolve(__dirname, "node_modules")],
  19. use: { loader: "babel-loader" }
  20. },
  21. {
  22. test: /\.html$/,
  23. use: [
  24. {
  25. loader: "html-loader",
  26. options: { minimize: true }
  27. }
  28. ]
  29. },
  30. {
  31. test: /\.css$/,
  32. use: ["vue-style-loader", "css-loader"]
  33. },
  34. {
  35. test: /\.scss$/,
  36. loaders: ["vue-style-loader", "css-loader", "sass-loader"]
  37. }
  38. ]
  39. },
  40. node: {
  41. fs: "empty"
  42. },
  43. resolve: {
  44. modules: [__dirname, "node_modules"]
  45. },
  46. plugins: [
  47. CopyWebpackPlugin([
  48. { from: path.resolve(__dirname, "src") },
  49. { from: path.resolve(__dirname, "libs") }
  50. // { from: path.resolve(__dirname, 'libs/system.js') },
  51. // { from: path.resolve(__dirname, 'libs/jquery.min.js') },
  52. // { from: path.resolve(__dirname, 'libs/base64.min.js') },
  53. // { from: path.resolve(__dirname, 'libs/Loadwebsign.js') },
  54. // { from: path.resolve(__dirname, 'libs/polyfill.js') },
  55. ]),
  56. new CleanWebpackPlugin(["portal"])
  57. ],
  58. devtool: "source-map",
  59. externals: [],
  60. mode: "development",
  61. devServer: {
  62. host: 'localhost',
  63. openPage: "login.html",
  64. contentBase: "./",
  65. historyApiFallback: true,
  66. watchOptions: { aggregateTimeout: 300, poll: 1000 },
  67. // headers: {
  68. // "Access-Control-Allow-Origin": "*",
  69. // "Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, PATCH, OPTIONS",
  70. // "Access-Control-Allow-Headers": "X-Requested-With, content-type, Authorization"
  71. // },
  72. // Proxy config for development purposes. In production, you would configure you webserver to do something similar.
  73. proxy: {
  74. "/accountability": {
  75. //通用功能子系統
  76. target: "http://localhost:8088",
  77. pathRewrite: { "^/accountability": "" }
  78. },
  79. "/publicfunction": {
  80. //通用功能子系統
  81. target: "http://localhost:9001",
  82. pathRewrite: { "^/publicfunction": "" }
  83. },
  84. "/grainCoManage": {
  85. target: "http://localhost:9002",
  86. pathRewrite: { "^/grainCoManage": "" }
  87. },
  88. "/ywbb": {
  89. target: "http://localhost:9003",
  90. pathRewrite: { "^/ywbb": "" }
  91. },
  92. "/grainReserves": {
  93. target: "http://localhost:9004",
  94. pathRewrite: { "^/grainReserves": "" }
  95. },
  96. "/grainreservesArea": {
  97. target: "http://localhost:8001",
  98. pathRewrite: { "^/grainreservesArea": "" }
  99. },
  100. "/grainReservesFirm": {
  101. target: "http://localhost:9007",
  102. pathRewrite: { "^/grainReservesFirm": "" }
  103. },
  104. "/emergency": {
  105. target: "http://localhost:9005",
  106. pathRewrite: { "^/emergency": "" }
  107. },
  108. "/financial": {
  109. target: "http://localhost:9001",
  110. pathRewrite: { "^/financial": "" }
  111. },
  112. "/quality": {
  113. target: "http://localhost:9008",
  114. pathRewrite: { "^/quality": "" }
  115. },
  116. //预警系统
  117. "/earlyWarning": {
  118. target: "http://localhost:9017",
  119. pathRewrite: { "^/earlyWarning": "" }
  120. },
  121. // "/myuser": {
  122. // target: "http://218.241.206.66:8097/myuser",
  123. // pathRewrite: {"^/myuser" : ""},
  124. // },
  125. "/myuser": {
  126. target: "http://192.168.80.230:8097/myuser",
  127. pathRewrite: { "^/myuser": "" }
  128. },
  129. "/monitor": {
  130. target: "http://localhost:9006",
  131. pathRewrite: { "^/monitor": "" }
  132. },
  133. "/main": {
  134. target: "http://10.223.3.39:9090",
  135. secure: false, // 如果是https接口,需要配置这个参数
  136. changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
  137. pathRewrite: { "^/main": "" }
  138. },
  139. "/tjapi": {
  140. target: "http://101.36.160.140:8097",
  141. secure: false, // 如果是https接口,需要配置这个参数
  142. changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
  143. pathRewrite: { "^/tjapi": "" }
  144. },
  145. "/nmapi": {
  146. target: "http://101.36.160.140:8097",
  147. secure: false, // 如果是https接口,需要配置这个参数
  148. changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
  149. pathRewrite: { "^/nmapi": "" }
  150. },
  151. "/fileApi": {
  152. target: "http://172.16.0.73:11010",
  153. secure: false, // 如果是https接口,需要配置这个参数
  154. changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
  155. pathRewrite: { "^/fileApi": "" }
  156. },
  157. "/huyong": {
  158. target: "http://192.168.50.198:13100/cbl",
  159. secure: false, // 如果是https接口,需要配置这个参数
  160. changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
  161. pathRewrite: { "^/huyong": "" }
  162. },
  163. "/unitApi": {
  164. target: "http://192.168.123.15:8098",
  165. secure: false, // 如果是https接口,需要配置这个参数
  166. changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
  167. pathRewrite: { "^/unitApi": "" }
  168. },
  169. "/todoApi": {
  170. target: "http://101.36.160.140:8097",
  171. secure: false, // 如果是https接口,需要配置这个参数
  172. changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
  173. pathRewrite: { "^/todoApi": "" }
  174. },
  175. "/circulate": {
  176. target: "http://localhost:9010",
  177. pathRewrite: { "^/circulate": "" }
  178. },
  179. "/transaction": {
  180. target: "http://localhost:9011",
  181. pathRewrite: { "^/transaction": "" }
  182. },
  183. "/decision": {
  184. target: "http://localhost:9012",
  185. pathRewrite: { "^/decision": "" }
  186. },
  187. "/inspection": {
  188. target: "http://localhost:9009",
  189. pathRewrite: { "^/inspection": "" }
  190. },
  191. "/headResponsibility": {
  192. target: "http://localhost:9010",
  193. pathRewrite: { "^/headResponsibility": "" }
  194. },
  195. "/industry": {
  196. target: "http://localhost:9100",
  197. pathRewrite: { "^/industry": "" }
  198. },
  199. "/safetyProduction": {
  200. target: "http://localhost:9999",
  201. pathRewrite: { "^/safetyProduction": "" }
  202. },
  203. "/systemSetting": {
  204. target: "http://localhost:2019",
  205. pathRewrite: { "^/systemSetting": "" }
  206. },
  207. "/webDecision": {
  208. target: "http://localhost:9013",
  209. pathRewrite: { "^/webDecision": "" }
  210. },
  211. "/projectmanage": {
  212. target: "http://localhost:9099",
  213. pathRewrite: { "^/projectmanage": "" }
  214. },
  215. "/log": {
  216. target: "http://localhost:9014",
  217. pathRewrite: { "^/log": "" }
  218. },
  219. "/safeProduction": {
  220. target: "http://localhost:9015",
  221. pathRewrite: { "^/safeProduction": "" }
  222. },
  223. "/hlht": {
  224. target: "http://101.36.160.140:8097/hlht",
  225. secure: false, // 如果是https接口,需要配置这个参数
  226. changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
  227. pathRewrite: { "^/hlht": "" }
  228. },
  229. "/operationservices": {
  230. //yunwei
  231. target: "http://localhost:9016",
  232. pathRewrite: { "^/operationservices": "" }
  233. },
  234. "/kjdepot": {
  235. target: "http://172.16.0.73:8889",
  236. pathRewrite: { "^/kjdepot": "" }
  237. },
  238. "/depot": {
  239. target: "http://101.36.160.140:8097/medicament",
  240. pathRewrite: { "^/depot": "" }
  241. },
  242. "/irpt-server": {
  243. target: "http://172.16.0.72:12032",
  244. pathRewrite: { "^/irpt-server": "" }
  245. },
  246. "/file": {
  247. target: "http://172.16.0.73:11010",
  248. pathRewrite: { "^/file": "" }
  249. },
  250. "/base-server": {
  251. target: "http://172.16.0.73:14100",
  252. pathRewrite: { "^/base-server": "" }
  253. },
  254. "/safety-service": {
  255. target: "http://172.16.0.72:13880",
  256. pathRewrite: { "^/safety-service": "" }
  257. },
  258. "/cjjd": {
  259. target: "http://172.16.0.72:8068",
  260. pathRewrite: { "^/cjjd": "" }
  261. },
  262. }
  263. }
  264. };