webpack.config.js 30 KB

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