webpack.configCopy.jsx 33 KB

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