webpack.config.js 27 KB

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