webpack.config.js 29 KB

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