webpack.configCopy.jsx 35 KB

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