webpack.config.js 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837
  1. const path = require('path');
  2. const HtmlWebpackPlugin = require('html-webpack-plugin');
  3. /*const HtmlWebpackInlineSourcePlugin=require('html-webpack-inline-source-plugin');*/
  4. const CleanWebpackPlugin = require('clean-webpack-plugin') // 清空打包目录的插件
  5. const MiniCssExtractPlugin = require('mini-css-extract-plugin');
  6. const CopyWebpackPlugin = require('copy-webpack-plugin');
  7. const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
  8. const webpack = require('webpack');
  9. const proxyHost = "http://192.168.2.236:5858";
  10. // const proxyHost = "http://192.168.2.241:5858";
  11. // const proxyHost = "http://192.168.4.222:5858";
  12. // const proxyHost = "http://192.168.3.117:5858";//铁钢
  13. // const proxyHost = "http://192.168.3.113:5858";//王峰
  14. module.exports = {
  15. entry: {
  16. index: path.resolve(__dirname, 'src/js', 'index.js'),
  17. qcScore:path.resolve(__dirname, 'src/js', 'qcScore.js'),
  18. login:path.resolve(__dirname, 'src/js', 'login.js'),
  19. console:path.resolve(__dirname, 'src/js', 'console.js'),
  20. deptConsole:path.resolve(__dirname, 'src/js', 'deptConsole.js'),
  21. moduleManager: path.resolve(__dirname, 'src/js', 'moduleManager.js'),
  22. itemManager: path.resolve(__dirname, 'src/js', 'itemManager.js'),
  23. qcList: path.resolve(__dirname, 'src/js', 'qcList.js'),
  24. qcListDocteam:path.resolve(__dirname, 'src/js', 'qcListDocteam.js'),
  25. qcListDept:path.resolve(__dirname, 'src/js', 'qcListDept.js'),
  26. qcListPerson:path.resolve(__dirname, 'src/js', 'qcListPerson.js'),
  27. userManager: path.resolve(__dirname, 'src/js', 'userManager.js'),
  28. roleManager: path.resolve(__dirname, 'src/js', 'roleManager.js'),
  29. tiaomu: path.resolve(__dirname, 'src/js', 'tiaomu.js'),
  30. mukuai: path.resolve(__dirname, 'src/js', 'mukuai.js'),
  31. abnormal: path.resolve(__dirname, 'src/js', 'abnormal.js'),
  32. partDetail: path.resolve(__dirname, 'src/js', 'partDetail.js'),
  33. dayDetail: path.resolve(__dirname, 'src/js', 'dayDetail.js'),
  34. payDetail: path.resolve(__dirname, 'src/js', 'payDetail.js'),
  35. deptScoreDetail: path.resolve(__dirname, 'src/js', 'deptScoreDetail.js'),
  36. deptScoreDetailControl: path.resolve(__dirname, 'src/js', 'deptScoreDetailControl.js'),
  37. jiaji: path.resolve(__dirname, 'src/js', 'jiaji.js'),
  38. partDetailControl: path.resolve(__dirname, 'src/js', 'partDetailControl.js'),
  39. quexianXQ: path.resolve(__dirname, 'src/js', 'quexianXQ.js'),
  40. quexianDetail: path.resolve(__dirname, 'src/js', 'quexianDetail.js'),
  41. quexianDetailControl: path.resolve(__dirname, 'src/js', 'quexianDetailControl.js'),
  42. quexianDetailHome: path.resolve(__dirname, 'src/js', 'quexianDetailHome.js'),
  43. quexianDetailControlHome: path.resolve(__dirname, 'src/js', 'quexianDetailControlHome.js'),
  44. mukuaiControl: path.resolve(__dirname, 'src/js', 'mukuaiControl.js'),
  45. tiaomuControl: path.resolve(__dirname, 'src/js', 'tiaomuControl.js'),
  46. assertType: path.resolve(__dirname, 'src/js', 'assertType.js'),
  47. assertTypeDetail: path.resolve(__dirname, 'src/js', 'assertTypeDetail.js'),
  48. singleVeto:path.resolve(__dirname, 'src/js', 'singleVeto.js'),
  49. itemDefectDetail:path.resolve(__dirname, 'src/js', 'itemDefectDetail.js'),
  50. keyItemFlawControl:path.resolve(__dirname, 'src/js', 'keyItemFlawControl.js'),
  51. qcListCopy:path.resolve(__dirname, 'src/js', 'qcListCopy.js'),
  52. qcListCopyUnqualified: path.resolve(__dirname, 'src/js', 'qcListCopyUnqualified.js'),
  53. qcListOutHospital:path.resolve(__dirname, 'src/js', 'qcListOutHospital.js'),
  54. checkControl:path.resolve(__dirname, 'src/js', 'checkControl.js'),
  55. advice:path.resolve(__dirname, 'src/js', 'advice.js'),
  56. uncorrectedCasesStatistics:path.resolve(__dirname, 'src/js', 'uncorrectedCasesStatistics.js'),
  57. uncorrectedCopy:path.resolve(__dirname, 'src/js', 'uncorrectedCopy.js'),
  58. uccDetail:path.resolve(__dirname, 'src/js', 'uccDetail.js'),
  59. readmission:path.resolve(__dirname, 'src/js', 'readmission.js'),
  60. pacs:path.resolve(__dirname, 'src/js', 'pacs.js'),
  61. pacsDetail:path.resolve(__dirname, 'src/js', 'pacsDetail.js'),
  62. assist:path.resolve(__dirname, 'src/js', 'assist.js'),
  63. error:path.resolve(__dirname, 'src/js', 'error.js'),
  64. nursing:path.resolve(__dirname, 'src/js', 'nursing.js'),
  65. vendor: 'lodash', //多个页面所需的公共库文件,防止重复打包带入
  66. },
  67. output: {
  68. publicPath: '/', //这里要放的是静态资源CDN的地址
  69. path: path.resolve(__dirname, 'dist'),
  70. filename: 'js/[name].js'
  71. },
  72. resolve: {
  73. extensions: [".js", ".css", ".json"],
  74. alias: {} //配置别名可以加快webpack查找模块的速度
  75. },
  76. plugins: [//多入口的html文件用chunks这个参数来区分
  77. new HtmlWebpackPlugin({
  78. title: 'index',
  79. template: path.resolve(__dirname, 'src/html', 'index.html'),
  80. filename: 'index.html',
  81. chunks: ['index', 'vendor', 'common','scrollBar'],
  82. hash: true, //防止缓存
  83. inject: true,
  84. minify: {
  85. removeAttributeQuotes: true, //压缩 去掉引号
  86. removeComments: true, //移除HTML中的注释
  87. collapseWhitespace: true //删除空白符与换行符
  88. }
  89. }),
  90. new HtmlWebpackPlugin({
  91. title: 'nursing',
  92. template: path.resolve(__dirname, 'src/html', 'nursing.html'),
  93. filename: 'nursing.html',
  94. chunks: ['nursing', 'vendor', 'common','scrollBar'],
  95. hash: true, //防止缓存
  96. inject: true,
  97. minify: {
  98. removeAttributeQuotes: true, //压缩 去掉引号
  99. removeComments: true, //移除HTML中的注释
  100. collapseWhitespace: true //删除空白符与换行符
  101. }
  102. }),
  103. new HtmlWebpackPlugin({
  104. title: 'error',
  105. template: path.resolve(__dirname, 'src/html', 'error.html'),
  106. filename: 'error.html',
  107. chunks: ['error', 'vendor', 'common'],
  108. hash: true, //防止缓存
  109. inject: true,
  110. minify: {
  111. removeAttributeQuotes: true, //压缩 去掉引号
  112. removeComments: true, //移除HTML中的注释
  113. collapseWhitespace: true //删除空白符与换行符
  114. }
  115. }),
  116. new HtmlWebpackPlugin({
  117. title: 'console.html',
  118. template: path.resolve(__dirname, 'src/html', 'console.html'),
  119. filename: 'console.html',
  120. chunks: ['console', 'vendor', 'common','scrollBar'],
  121. hash: true, //防止缓存
  122. inject: true,
  123. minify: {
  124. removeAttributeQuotes: true, //压缩 去掉引号
  125. removeComments: true, //移除HTML中的注释
  126. collapseWhitespace: true //删除空白符与换行符
  127. }
  128. }),
  129. new HtmlWebpackPlugin({
  130. title: 'uncorrectedCopy.html',
  131. template: path.resolve(__dirname, 'src/html', 'uncorrectedCopy.html'),
  132. filename: 'uncorrectedCopy.html',
  133. chunks: ['uncorrectedCopy', 'vendor', 'common','scrollBar'],
  134. hash: true, //防止缓存
  135. inject: true,
  136. minify: {
  137. removeAttributeQuotes: true, //压缩 去掉引号
  138. removeComments: true, //移除HTML中的注释
  139. collapseWhitespace: true //删除空白符与换行符
  140. }
  141. }),
  142. new HtmlWebpackPlugin({
  143. title: 'pacs.html',
  144. template: path.resolve(__dirname, 'src/html', 'pacs.html'),
  145. filename: 'pacs.html',
  146. chunks: ['pacs', 'vendor', 'common','scrollBar'],
  147. hash: true, //防止缓存
  148. inject: true,
  149. minify: {
  150. removeAttributeQuotes: true, //压缩 去掉引号
  151. removeComments: true, //移除HTML中的注释
  152. collapseWhitespace: true //删除空白符与换行符
  153. }
  154. }),
  155. new HtmlWebpackPlugin({
  156. title: 'pacsDetail.html',
  157. template: path.resolve(__dirname, 'src/html', 'pacsDetail.html'),
  158. filename: 'pacsDetail.html',
  159. chunks: ['pacsDetail', 'vendor', 'common','scrollBar'],
  160. hash: true, //防止缓存
  161. inject: true,
  162. minify: {
  163. removeAttributeQuotes: true, //压缩 去掉引号
  164. removeComments: true, //移除HTML中的注释
  165. collapseWhitespace: true //删除空白符与换行符
  166. }
  167. }),
  168. new HtmlWebpackPlugin({
  169. title: 'assist.html',
  170. template: path.resolve(__dirname, 'src/html', 'assist.html'),
  171. filename: 'assist.html',
  172. chunks: ['assist', 'vendor', 'common','scrollBar'],
  173. hash: true, //防止缓存
  174. inject: true,
  175. minify: {
  176. removeAttributeQuotes: true, //压缩 去掉引号
  177. removeComments: true, //移除HTML中的注释
  178. collapseWhitespace: true //删除空白符与换行符
  179. }
  180. }),
  181. new HtmlWebpackPlugin({
  182. title: 'advice.html',
  183. template: path.resolve(__dirname, 'src/html', 'advice.html'),
  184. filename: 'advice.html',
  185. chunks: ['advice', 'vendor', 'common'],
  186. hash: true, //防止缓存
  187. inject: true,
  188. minify: {
  189. removeAttributeQuotes: true, //压缩 去掉引号
  190. removeComments: true, //移除HTML中的注释
  191. collapseWhitespace: true //删除空白符与换行符
  192. }
  193. }),
  194. new HtmlWebpackPlugin({
  195. title: 'tiaomuControl.html',
  196. template: path.resolve(__dirname, 'src/html', 'tiaomuControl.html'),
  197. filename: 'tiaomuControl.html',
  198. chunks: ['tiaomuControl', 'vendor', 'common'],
  199. hash: true, //防止缓存
  200. inject: true,
  201. minify: {
  202. removeAttributeQuotes: true, //压缩 去掉引号
  203. removeComments: true, //移除HTML中的注释
  204. collapseWhitespace: true //删除空白符与换行符
  205. }
  206. }),
  207. new HtmlWebpackPlugin({
  208. title: 'checkControl.html',
  209. template: path.resolve(__dirname, 'src/html', 'checkControl.html'),
  210. filename: 'checkControl.html',
  211. chunks: ['checkControl', 'vendor', 'common'],
  212. hash: true, //防止缓存
  213. inject: true,
  214. minify: {
  215. removeAttributeQuotes: true, //压缩 去掉引号
  216. removeComments: true, //移除HTML中的注释
  217. collapseWhitespace: true //删除空白符与换行符
  218. }
  219. }),
  220. new HtmlWebpackPlugin({
  221. title: 'assertTypeDetail.html',
  222. template: path.resolve(__dirname, 'src/html', 'assertTypeDetail.html'),
  223. filename: 'assertTypeDetail.html',
  224. chunks: ['assertTypeDetail', 'vendor', 'common'],
  225. hash: true, //防止缓存
  226. inject: true,
  227. minify: {
  228. removeAttributeQuotes: true, //压缩 去掉引号
  229. removeComments: true, //移除HTML中的注释
  230. collapseWhitespace: true //删除空白符与换行符
  231. }
  232. }),
  233. new HtmlWebpackPlugin({
  234. title: 'assertType.html',
  235. template: path.resolve(__dirname, 'src/html', 'assertType.html'),
  236. filename: 'assertType.html',
  237. chunks: ['assertType', 'vendor', 'common'],
  238. hash: true, //防止缓存
  239. inject: true,
  240. minify: {
  241. removeAttributeQuotes: true, //压缩 去掉引号
  242. removeComments: true, //移除HTML中的注释
  243. collapseWhitespace: true //删除空白符与换行符
  244. }
  245. }),
  246. new HtmlWebpackPlugin({
  247. title: 'mukuaiControl.html',
  248. template: path.resolve(__dirname, 'src/html', 'mukuaiControl.html'),
  249. filename: 'mukuaiControl.html',
  250. chunks: ['mukuaiControl', 'vendor', 'common'],
  251. hash: true, //防止缓存
  252. inject: true,
  253. minify: {
  254. removeAttributeQuotes: true, //压缩 去掉引号
  255. removeComments: true, //移除HTML中的注释
  256. collapseWhitespace: true //删除空白符与换行符
  257. }
  258. }),
  259. new HtmlWebpackPlugin({
  260. title: 'quexianDetail.html',
  261. template: path.resolve(__dirname, 'src/html', 'quexianDetail.html'),
  262. filename: 'quexianDetail.html',
  263. chunks: ['quexianDetail', 'vendor', 'common'],
  264. hash: true, //防止缓存
  265. inject: true,
  266. minify: {
  267. removeAttributeQuotes: true, //压缩 去掉引号
  268. removeComments: true, //移除HTML中的注释
  269. collapseWhitespace: true //删除空白符与换行符
  270. }
  271. }),
  272. new HtmlWebpackPlugin({
  273. title: 'quexianDetailHome.html',
  274. template: path.resolve(__dirname, 'src/html', 'quexianDetailHome.html'),
  275. filename: 'quexianDetailHome.html',
  276. chunks: ['quexianDetailHome', 'vendor', 'common'],
  277. hash: true, //防止缓存
  278. inject: true,
  279. minify: {
  280. removeAttributeQuotes: true, //压缩 去掉引号
  281. removeComments: true, //移除HTML中的注释
  282. collapseWhitespace: true //删除空白符与换行符
  283. }
  284. }),
  285. new HtmlWebpackPlugin({
  286. title: 'quexianDetailControl.html',
  287. template: path.resolve(__dirname, 'src/html', 'quexianDetailControl.html'),
  288. filename: 'quexianDetailControl.html',
  289. chunks: ['quexianDetailControl', 'vendor', 'common'],
  290. hash: true, //防止缓存
  291. inject: true,
  292. minify: {
  293. removeAttributeQuotes: true, //压缩 去掉引号
  294. removeComments: true, //移除HTML中的注释
  295. collapseWhitespace: true //删除空白符与换行符
  296. }
  297. }),
  298. new HtmlWebpackPlugin({
  299. title: 'quexianDetailControlHome.html',
  300. template: path.resolve(__dirname, 'src/html', 'quexianDetailControlHome.html'),
  301. filename: 'quexianDetailControlHome.html',
  302. chunks: ['quexianDetailControlHome', 'vendor', 'common'],
  303. hash: true, //防止缓存
  304. inject: true,
  305. minify: {
  306. removeAttributeQuotes: true, //压缩 去掉引号
  307. removeComments: true, //移除HTML中的注释
  308. collapseWhitespace: true //删除空白符与换行符
  309. }
  310. }),
  311. new HtmlWebpackPlugin({
  312. title: 'quexianXQ.html',
  313. template: path.resolve(__dirname, 'src/html', 'quexianXQ.html'),
  314. filename: 'quexianXQ.html',
  315. chunks: ['quexianXQ', 'vendor', 'common'],
  316. hash: true, //防止缓存
  317. inject: true,
  318. minify: {
  319. removeAttributeQuotes: true, //压缩 去掉引号
  320. removeComments: true, //移除HTML中的注释
  321. collapseWhitespace: true //删除空白符与换行符
  322. }
  323. }),
  324. new HtmlWebpackPlugin({
  325. title: 'partDetailControl.html',
  326. template: path.resolve(__dirname, 'src/html', 'partDetailControl.html'),
  327. filename: 'partDetailControl.html',
  328. chunks: ['partDetailControl', 'vendor', 'common'],
  329. hash: true, //防止缓存
  330. inject: true,
  331. minify: {
  332. removeAttributeQuotes: true, //压缩 去掉引号
  333. removeComments: true, //移除HTML中的注释
  334. collapseWhitespace: true //删除空白符与换行符
  335. }
  336. }),
  337. new HtmlWebpackPlugin({
  338. title: 'jiaji.html',
  339. template: path.resolve(__dirname, 'src/html', 'jiaji.html'),
  340. filename: 'jiaji.html',
  341. chunks: ['jiaji', 'vendor', 'common'],
  342. hash: true, //防止缓存
  343. inject: true,
  344. minify: {
  345. removeAttributeQuotes: true, //压缩 去掉引号
  346. removeComments: true, //移除HTML中的注释
  347. collapseWhitespace: true //删除空白符与换行符
  348. }
  349. }),
  350. new HtmlWebpackPlugin({
  351. title: 'abnormal.html',
  352. template: path.resolve(__dirname, 'src/html', 'abnormal.html'),
  353. filename: 'abnormal.html',
  354. chunks: ['abnormal', 'vendor', 'common'],
  355. hash: true, //防止缓存
  356. inject: true,
  357. minify: {
  358. removeAttributeQuotes: true, //压缩 去掉引号
  359. removeComments: true, //移除HTML中的注释
  360. collapseWhitespace: true //删除空白符与换行符
  361. }
  362. }),
  363. new HtmlWebpackPlugin({
  364. title: 'deptScoreDetailControl.html',
  365. template: path.resolve(__dirname, 'src/html', 'deptScoreDetailControl.html'),
  366. filename: 'deptScoreDetailControl.html',
  367. chunks: ['deptScoreDetailControl', 'vendor', 'common'],
  368. hash: true, //防止缓存
  369. inject: true,
  370. minify: {
  371. removeAttributeQuotes: true, //压缩 去掉引号
  372. removeComments: true, //移除HTML中的注释
  373. collapseWhitespace: true //删除空白符与换行符
  374. }
  375. }),
  376. new HtmlWebpackPlugin({
  377. title: 'payDetail.html',
  378. template: path.resolve(__dirname, 'src/html', 'payDetail.html'),
  379. filename: 'payDetail.html',
  380. chunks: ['payDetail', 'vendor', 'common'],
  381. hash: true, //防止缓存
  382. inject: true,
  383. minify: {
  384. removeAttributeQuotes: true, //压缩 去掉引号
  385. removeComments: true, //移除HTML中的注释
  386. collapseWhitespace: true //删除空白符与换行符
  387. }
  388. }),
  389. new HtmlWebpackPlugin({
  390. title: 'partDetail.html',
  391. template: path.resolve(__dirname, 'src/html', 'partDetail.html'),
  392. filename: 'partDetail.html',
  393. chunks: ['partDetail', 'vendor', 'common'],
  394. hash: true, //防止缓存
  395. inject: true,
  396. minify: {
  397. removeAttributeQuotes: true, //压缩 去掉引号
  398. removeComments: true, //移除HTML中的注释
  399. collapseWhitespace: true //删除空白符与换行符
  400. }
  401. }),
  402. new HtmlWebpackPlugin({
  403. title: 'dayDetail.html',
  404. template: path.resolve(__dirname, 'src/html', 'dayDetail.html'),
  405. filename: 'dayDetail.html',
  406. chunks: ['dayDetail', 'vendor', 'common'],
  407. hash: true, //防止缓存
  408. inject: true,
  409. minify: {
  410. removeAttributeQuotes: true, //压缩 去掉引号
  411. removeComments: true, //移除HTML中的注释
  412. collapseWhitespace: true //删除空白符与换行符
  413. }
  414. }),
  415. new HtmlWebpackPlugin({
  416. title: 'deptScoreDetail.html',
  417. template: path.resolve(__dirname, 'src/html', 'deptScoreDetail.html'),
  418. filename: 'deptScoreDetail.html',
  419. chunks: ['deptScoreDetail', 'vendor', 'common'],
  420. hash: true, //防止缓存
  421. inject: true,
  422. minify: {
  423. removeAttributeQuotes: true, //压缩 去掉引号
  424. removeComments: true, //移除HTML中的注释
  425. collapseWhitespace: true //删除空白符与换行符
  426. }
  427. }),
  428. new HtmlWebpackPlugin({
  429. title: 'deptConsole.html',
  430. template: path.resolve(__dirname, 'src/html', 'deptConsole.html'),
  431. filename: 'deptConsole.html',
  432. chunks: ['deptConsole', 'vendor', 'common'],
  433. hash: true, //防止缓存
  434. inject: true,
  435. minify: {
  436. removeAttributeQuotes: true, //压缩 去掉引号
  437. removeComments: true, //移除HTML中的注释
  438. collapseWhitespace: true //删除空白符与换行符
  439. }
  440. }),
  441. new HtmlWebpackPlugin({
  442. title: 'itemManager.html',
  443. template: path.resolve(__dirname, 'src/html', 'itemManager.html'),
  444. filename: 'itemManager.html',
  445. chunks: ['itemManager', 'vendor', 'common'],
  446. hash: true, //防止缓存
  447. inject: true,
  448. minify: {
  449. removeAttributeQuotes: true, //压缩 去掉引号
  450. removeComments: true, //移除HTML中的注释
  451. collapseWhitespace: true //删除空白符与换行符
  452. }
  453. }),
  454. new HtmlWebpackPlugin({
  455. title: 'moduleManager.html',
  456. template: path.resolve(__dirname, 'src/html', 'moduleManager.html'),
  457. filename: 'moduleManager.html',
  458. chunks: ['moduleManager', 'vendor', 'common'],
  459. hash: true, //防止缓存
  460. inject: true,
  461. minify: {
  462. removeAttributeQuotes: true, //压缩 去掉引号
  463. removeComments: true, //移除HTML中的注释
  464. collapseWhitespace: true //删除空白符与换行符
  465. }
  466. }),
  467. new HtmlWebpackPlugin({
  468. title: 'tiaomu.html',
  469. template: path.resolve(__dirname, 'src/html', 'tiaomu.html'),
  470. filename: 'tiaomu.html',
  471. chunks: ['tiaomu', 'vendor', 'common'],
  472. hash: true, //防止缓存
  473. inject: true,
  474. minify: {
  475. removeAttributeQuotes: true, //压缩 去掉引号
  476. removeComments: true, //移除HTML中的注释
  477. collapseWhitespace: true //删除空白符与换行符
  478. }
  479. }),
  480. new HtmlWebpackPlugin({
  481. title: 'mukuai.html',
  482. template: path.resolve(__dirname, 'src/html', 'mukuai.html'),
  483. filename: 'mukuai.html',
  484. chunks: ['mukuai', 'vendor', 'common'],
  485. hash: true, //防止缓存
  486. inject: true,
  487. minify: {
  488. removeAttributeQuotes: true, //压缩 去掉引号
  489. removeComments: true, //移除HTML中的注释
  490. collapseWhitespace: true //删除空白符与换行符
  491. }
  492. }),
  493. new HtmlWebpackPlugin({
  494. title: 'login.html',
  495. template: path.resolve(__dirname, 'src/html', 'login.html'),
  496. filename: 'login.html',
  497. chunks: ['login', 'vendor', 'common'],
  498. hash: true, //防止缓存
  499. inject: true,
  500. minify: {
  501. removeAttributeQuotes: true, //压缩 去掉引号
  502. removeComments: true, //移除HTML中的注释
  503. collapseWhitespace: true //删除空白符与换行符
  504. }
  505. }),
  506. new HtmlWebpackPlugin({
  507. title: 'qcList.html',
  508. template: path.resolve(__dirname, 'src/html', 'qcList.html'),
  509. filename: 'qcList.html',
  510. chunks: ['qcList', 'vendor', 'common'],
  511. hash: true, //防止缓存
  512. inject: true,
  513. minify: {
  514. removeAttributeQuotes: true, //压缩 去掉引号
  515. removeComments: true, //移除HTML中的注释
  516. collapseWhitespace: true //删除空白符与换行符
  517. }
  518. }),
  519. new HtmlWebpackPlugin({
  520. title: 'qcListCopy.html',
  521. template: path.resolve(__dirname, 'src/html', 'qcListCopy.html'),
  522. filename: 'qcListCopy.html',
  523. chunks: ['qcListCopy', 'vendor', 'common'],
  524. hash: true, //防止缓存
  525. inject: true,
  526. minify: {
  527. removeAttributeQuotes: true, //压缩 去掉引号
  528. removeComments: true, //移除HTML中的注释
  529. collapseWhitespace: true //删除空白符与换行符
  530. }
  531. }),
  532. new HtmlWebpackPlugin({
  533. title: 'qcListCopyUnqualified.html',
  534. template: path.resolve(__dirname, 'src/html', 'qcListCopyUnqualified.html'),
  535. filename: 'qcListCopyUnqualified.html',
  536. chunks: ['qcListCopyUnqualified', 'vendor', 'common'],
  537. hash: true, //防止缓存
  538. inject: true,
  539. minify: {
  540. removeAttributeQuotes: true, //压缩 去掉引号
  541. removeComments: true, //移除HTML中的注释
  542. collapseWhitespace: true //删除空白符与换行符
  543. }
  544. }),
  545. new HtmlWebpackPlugin({
  546. title: 'qcListOutHospital.html',
  547. template: path.resolve(__dirname, 'src/html', 'qcListOutHospital.html'),
  548. filename: 'qcListOutHospital.html',
  549. chunks: ['qcListOutHospital', 'vendor', 'common'],
  550. hash: true, //防止缓存
  551. inject: true,
  552. minify: {
  553. removeAttributeQuotes: true, //压缩 去掉引号
  554. removeComments: true, //移除HTML中的注释
  555. collapseWhitespace: true //删除空白符与换行符
  556. }
  557. }),
  558. new HtmlWebpackPlugin({
  559. title: 'qcListDocteam.html',
  560. template: path.resolve(__dirname, 'src/html', 'qcListDocteam.html'),
  561. filename: 'qcListDocteam.html',
  562. chunks: ['qcListDocteam', 'vendor', 'common'],
  563. hash: true, //防止缓存
  564. inject: true,
  565. minify: {
  566. removeAttributeQuotes: true, //压缩 去掉引号
  567. removeComments: true, //移除HTML中的注释
  568. collapseWhitespace: true //删除空白符与换行符
  569. }
  570. }),
  571. new HtmlWebpackPlugin({
  572. title: 'qcListPerson.html',
  573. template: path.resolve(__dirname, 'src/html', 'qcListPerson.html'),
  574. filename: 'qcListPerson.html',
  575. chunks: ['qcListPerson', 'vendor', 'common'],
  576. hash: true, //防止缓存
  577. inject: true,
  578. minify: {
  579. removeAttributeQuotes: true, //压缩 去掉引号
  580. removeComments: true, //移除HTML中的注释
  581. collapseWhitespace: true //删除空白符与换行符
  582. }
  583. }),
  584. new HtmlWebpackPlugin({
  585. title: 'qcListDept.html',
  586. template: path.resolve(__dirname, 'src/html', 'qcListDept.html'),
  587. filename: 'qcListDept.html',
  588. chunks: ['qcListDept', 'vendor', 'common'],
  589. hash: true, //防止缓存
  590. inject: true,
  591. minify: {
  592. removeAttributeQuotes: true, //压缩 去掉引号
  593. removeComments: true, //移除HTML中的注释
  594. collapseWhitespace: true //删除空白符与换行符
  595. }
  596. }),
  597. new HtmlWebpackPlugin({
  598. title: 'qcScore.html',
  599. template: path.resolve(__dirname, 'src/html', 'qcScore.html'),
  600. filename: 'qcScore.html',
  601. chunks: [ 'qcScore','vendor', 'common'],
  602. hash: true, //防止缓存
  603. inject: true,
  604. minify: {
  605. removeAttributeQuotes: true, //压缩 去掉引号
  606. removeComments: true, //移除HTML中的注释
  607. collapseWhitespace: true //删除空白符与换行符
  608. }
  609. }),
  610. new HtmlWebpackPlugin({
  611. title: 'statistics.html',
  612. template: path.resolve(__dirname, 'src/html', 'statistics.html'),
  613. filename: 'statistics.html',
  614. chunks: ['index', 'vendor', 'common'],
  615. hash: true, //防止缓存
  616. inject: true,
  617. minify: {
  618. removeAttributeQuotes: true, //压缩 去掉引号
  619. removeComments: true, //移除HTML中的注释
  620. collapseWhitespace: true //删除空白符与换行符
  621. }
  622. }),
  623. new HtmlWebpackPlugin({
  624. title: 'userManager.html',
  625. template: path.resolve(__dirname, 'src/html', 'userManager.html'),
  626. filename: 'userManager.html',
  627. chunks: ['userManager', 'vendor', 'common'],
  628. hash: true, //防止缓存
  629. inject: true,
  630. minify: {
  631. removeAttributeQuotes: true, //压缩 去掉引号
  632. removeComments: true, //移除HTML中的注释
  633. collapseWhitespace: true //删除空白符与换行符
  634. }
  635. }),
  636. new HtmlWebpackPlugin({
  637. title: 'roleManager.html',
  638. template: path.resolve(__dirname, 'src/html', 'roleManager.html'),
  639. filename: 'roleManager.html',
  640. chunks: ['roleManager', 'vendor', 'common'],
  641. hash: true, //防止缓存
  642. inject: true,
  643. minify: {
  644. removeAttributeQuotes: true, //压缩 去掉引号
  645. removeComments: true, //移除HTML中的注释
  646. collapseWhitespace: true //删除空白符与换行符
  647. }
  648. }),
  649. new HtmlWebpackPlugin({
  650. title: 'singleVeto.html', //单项否决详情页
  651. template: path.resolve(__dirname, 'src/html', 'singleVeto.html'),
  652. filename: 'singleVeto.html',
  653. chunks: ['singleVeto', 'vendor', 'common'],
  654. hash: true, //防止缓存
  655. inject: true,
  656. minify: {
  657. removeAttributeQuotes: true, //压缩 去掉引号
  658. removeComments: true, //移除HTML中的注释
  659. collapseWhitespace: true //删除空白符与换行符
  660. }
  661. }),
  662. new HtmlWebpackPlugin({
  663. title: 'itemDefectDetail.html', //单项否决详情页
  664. template: path.resolve(__dirname, 'src/html', 'itemDefectDetail.html'),
  665. filename: 'itemDefectDetail.html',
  666. chunks: ['itemDefectDetail', 'vendor', 'common'],
  667. hash: true, //防止缓存
  668. inject: true,
  669. minify: {
  670. removeAttributeQuotes: true, //压缩 去掉引号
  671. removeComments: true, //移除HTML中的注释
  672. collapseWhitespace: true //删除空白符与换行符
  673. }
  674. }),
  675. new HtmlWebpackPlugin({
  676. title: 'keyItemFlawControl.html', //关键条目缺陷占比
  677. template: path.resolve(__dirname, 'src/html', 'keyItemFlawControl.html'),
  678. filename: 'keyItemFlawControl.html',
  679. chunks: ['keyItemFlawControl', 'vendor', 'common'],
  680. hash: true, //防止缓存
  681. inject: true,
  682. minify: {
  683. removeAttributeQuotes: true, //压缩 去掉引号
  684. removeComments: true, //移除HTML中的注释
  685. collapseWhitespace: true //删除空白符与换行符
  686. }
  687. }),
  688. new HtmlWebpackPlugin({
  689. title: 'uncorrectedCasesStatistics.html', //未整改病历统计
  690. template: path.resolve(__dirname, 'src/html', 'uncorrectedCasesStatistics.html'),
  691. filename: 'uncorrectedCasesStatistics.html',
  692. chunks: ['uncorrectedCasesStatistics', 'vendor', 'common'],
  693. hash: true, //防止缓存
  694. inject: true,
  695. minify: {
  696. removeAttributeQuotes: true, //压缩 去掉引号
  697. removeComments: true, //移除HTML中的注释
  698. collapseWhitespace: true //删除空白符与换行符
  699. }
  700. }),
  701. new HtmlWebpackPlugin({
  702. title: 'uccDetail.html', //未整改病历统计_缺陷详情
  703. template: path.resolve(__dirname, 'src/html', 'uccDetail.html'),
  704. filename: 'uccDetail.html',
  705. chunks: ['uccDetail', 'vendor', 'common'],
  706. hash: true, //防止缓存
  707. inject: true,
  708. minify: {
  709. removeAttributeQuotes: true, //压缩 去掉引号
  710. removeComments: true, //移除HTML中的注释
  711. collapseWhitespace: true //删除空白符与换行符
  712. }
  713. }),
  714. new HtmlWebpackPlugin({
  715. title: 'readmission.html', //未整改病历统计_缺陷详情
  716. template: path.resolve(__dirname, 'src/html', 'readmission.html'),
  717. filename: 'readmission.html',
  718. chunks: ['readmission', 'vendor', 'common'],
  719. hash: true, //防止缓存
  720. inject: true,
  721. minify: {
  722. removeAttributeQuotes: true, //压缩 去掉引号
  723. removeComments: true, //移除HTML中的注释
  724. collapseWhitespace: true //删除空白符与换行符
  725. }
  726. }),
  727. new CopyWebpackPlugin([
  728. {
  729. from:'src/resource',
  730. to:path.resolve(__dirname,'dist','resource'),
  731. flatten:true, //false会拷贝原始文件夹路径
  732. }
  733. ]),
  734. new MiniCssExtractPlugin({
  735. filename: 'css/[name].css',
  736. chunkFilename: '[id].css'
  737. }),
  738. new webpack.HotModuleReplacementPlugin(),
  739. new CleanWebpackPlugin()
  740. ],
  741. optimization: { //webpack4.x的最新优化配置项,用于提取公共代码
  742. minimizer: [
  743. new UglifyJsPlugin({
  744. uglifyOptions: {
  745. ie8: true,
  746. compress: {
  747. properties: false,
  748. warnings: false
  749. },
  750. mangle: {
  751. screw_ie8: false,
  752. except: ['e']
  753. },
  754. output: {
  755. beautify: true
  756. },
  757. sourceMap: false
  758. }
  759. })
  760. ],
  761. splitChunks: {
  762. cacheGroups: {
  763. commons: {
  764. chunks: "initial",
  765. name: "common",
  766. minChunks: 2,
  767. maxInitialRequests: 5, // The default limit is too small to showcase the effect
  768. minSize: 0, // This is example is too small to create commons chunks
  769. reuseExistingChunk: true // 可设置是否重用该chunk
  770. }
  771. }
  772. }
  773. },
  774. module: {
  775. noParse: /WdatePicker/,
  776. rules: [
  777. {
  778. test: /.js$/,
  779. enforce: 'post',
  780. loader: 'es3ify-loader'
  781. },
  782. {
  783. test: /\.m?js$/,
  784. exclude: /(node_modules|bower_components)/,
  785. use: {
  786. loader: 'babel-loader',
  787. options: {
  788. presets:['@babel/preset-env']
  789. }
  790. }
  791. },
  792. {
  793. test: /\.css$/,
  794. use: [{
  795. loader: MiniCssExtractPlugin.loader
  796. },
  797. 'css-loader'
  798. ]
  799. },
  800. {
  801. test: /\.less$/,
  802. use: [{
  803. loader: MiniCssExtractPlugin.loader
  804. },
  805. 'css-loader', 'less-loader'
  806. ]
  807. },
  808. {
  809. test:/\.(png|gif|jpg|jpeg|svg|eot|ttf|woff|woff2)$/,
  810. use:[{
  811. loader:'url-loader',
  812. options:{
  813. limit:10240,
  814. esModule:false,
  815. name:'[name]_[hash:6].[ext]',
  816. outputPath:'images/'
  817. }
  818. }],
  819. exclude:/node_modules/
  820. },{
  821. test:/.html$/,
  822. use:'html-withimg-loader'
  823. }
  824. ]
  825. },
  826. // devtool: 'cheap-module-eval-source-map', //开发环境cheap-module-eval-source-map //生产环境cheap-module-source-map
  827. mode: 'development',
  828. devServer: {
  829. contentBase: "./dist", //静态文件根目录
  830. proxy: {
  831. '/': proxyHost
  832. },
  833. hot: true,
  834. openPage:'login.html'
  835. }
  836. }