webpack.configCopy.jsx 32 KB

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