webpack.config.js 31 KB

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