webpack.config.js 31 KB

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