const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
/*const HtmlWebpackInlineSourcePlugin=require('html-webpack-inline-source-plugin');*/
const CleanWebpackPlugin = require('clean-webpack-plugin') // 清空打包目录的插件
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const webpack = require('webpack');
// const proxyHost = "http://192.168.2.236:5858";
const proxyHost = "http://172.16.8.12:5859";
// const proxyHost = "http://192.168.4.222:5858";
// const proxyHost = "http://192.168.3.117:5858";//铁钢
// const proxyHost = "http://192.168.3.113:5858";//王峰
module.exports = {
  entry: {
    index: path.resolve(__dirname, 'src/js', 'index.js'),
    qcScore:path.resolve(__dirname, 'src/js', 'qcScore.js'),
    login:path.resolve(__dirname, 'src/js', 'login.js'),
    console:path.resolve(__dirname, 'src/js', 'console.js'),
    deptConsole:path.resolve(__dirname, 'src/js', 'deptConsole.js'),
    moduleManager: path.resolve(__dirname, 'src/js', 'moduleManager.js'),
    itemManager: path.resolve(__dirname, 'src/js', 'itemManager.js'),
    qcList: path.resolve(__dirname, 'src/js', 'qcList.js'),
    qcListDocteam:path.resolve(__dirname, 'src/js', 'qcListDocteam.js'),
    qcListDept:path.resolve(__dirname, 'src/js', 'qcListDept.js'),
    qcListPerson:path.resolve(__dirname, 'src/js', 'qcListPerson.js'),
    userManager: path.resolve(__dirname, 'src/js', 'userManager.js'),
    roleManager: path.resolve(__dirname, 'src/js', 'roleManager.js'),
    tiaomu: path.resolve(__dirname, 'src/js', 'tiaomu.js'),
    mukuai: path.resolve(__dirname, 'src/js', 'mukuai.js'),
    abnormal: path.resolve(__dirname, 'src/js', 'abnormal.js'),
    partDetail: path.resolve(__dirname, 'src/js', 'partDetail.js'),
    dayDetail: path.resolve(__dirname, 'src/js', 'dayDetail.js'),
    payDetail: path.resolve(__dirname, 'src/js', 'payDetail.js'),
    deptScoreDetail: path.resolve(__dirname, 'src/js', 'deptScoreDetail.js'),
    deptScoreDetailControl: path.resolve(__dirname, 'src/js', 'deptScoreDetailControl.js'),
    jiaji: path.resolve(__dirname, 'src/js', 'jiaji.js'),
    partDetailControl: path.resolve(__dirname, 'src/js', 'partDetailControl.js'),
    quexianXQ: path.resolve(__dirname, 'src/js', 'quexianXQ.js'),
    quexianDetail: path.resolve(__dirname, 'src/js', 'quexianDetail.js'),
    quexianDetailControl: path.resolve(__dirname, 'src/js', 'quexianDetailControl.js'),
    quexianDetailHome: path.resolve(__dirname, 'src/js', 'quexianDetailHome.js'),
    quexianDetailControlHome: path.resolve(__dirname, 'src/js', 'quexianDetailControlHome.js'),
    mukuaiControl: path.resolve(__dirname, 'src/js', 'mukuaiControl.js'),
    tiaomuControl: path.resolve(__dirname, 'src/js', 'tiaomuControl.js'),
    assertType: path.resolve(__dirname, 'src/js', 'assertType.js'),
    assertTypeDetail: path.resolve(__dirname, 'src/js', 'assertTypeDetail.js'),
    singleVeto:path.resolve(__dirname, 'src/js', 'singleVeto.js'),
    itemDefectDetail:path.resolve(__dirname, 'src/js', 'itemDefectDetail.js'),
    keyItemFlawControl:path.resolve(__dirname, 'src/js', 'keyItemFlawControl.js'),
    qcListCopy:path.resolve(__dirname, 'src/js', 'qcListCopy.js'),
    qcListCopyquexian: path.resolve(__dirname, 'src/js', 'qcListCopyquexian.js'),
    qcListCopyUnqualified: path.resolve(__dirname, 'src/js', 'qcListCopyUnqualified.js'),
    qcListOutHospital:path.resolve(__dirname, 'src/js', 'qcListOutHospital.js'),
    checkControl:path.resolve(__dirname, 'src/js', 'checkControl.js'),
    advice:path.resolve(__dirname, 'src/js', 'advice.js'),
    uncorrectedCasesStatistics:path.resolve(__dirname, 'src/js', 'uncorrectedCasesStatistics.js'),
    uncorrectedCopy:path.resolve(__dirname, 'src/js', 'uncorrectedCopy.js'),
    uccDetail:path.resolve(__dirname, 'src/js', 'uccDetail.js'),
    readmission:path.resolve(__dirname, 'src/js', 'readmission.js'),
    pacs:path.resolve(__dirname, 'src/js', 'pacs.js'),
    pacsDetail:path.resolve(__dirname, 'src/js', 'pacsDetail.js'),
    assist:path.resolve(__dirname, 'src/js', 'assist.js'),
    error:path.resolve(__dirname, 'src/js', 'error.js'),
    nursing:path.resolve(__dirname, 'src/js', 'nursing.js'),
    test:path.resolve(__dirname, 'src/js/dept', 'test.js'),
    partDetailControlDept:path.resolve(__dirname, 'src/js/dept', 'partDetailControlDept.js'),
    vendor: 'lodash',  //多个页面所需的公共库文件，防止重复打包带入
  },
  output: {
    publicPath: '/', //这里要放的是静态资源CDN的地址
    path: path.resolve(__dirname, 'dist'),
    filename: 'js/[name].js'
  },
  resolve: {
    extensions: [".js", ".css", ".json"],
    alias: {} //配置别名可以加快webpack查找模块的速度
  },
  plugins: [//多入口的html文件用chunks这个参数来区分
    new HtmlWebpackPlugin({
      title: 'test',
      template: path.resolve(__dirname, 'src/html/dept', 'test.html'),
      filename: 'test.html',
      chunks: ['test', 'vendor', 'common','src/resouce/dot.js'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'index',
      template: path.resolve(__dirname, 'src/html', 'index.html'),
      filename: 'index.html',
      chunks: ['index', 'vendor', 'common','scrollBar','src/resouce/dot.js'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'partDetailControlDept',
      template: path.resolve(__dirname, 'src/html/dept', 'partDetailControlDept.html'),
      filename: 'partDetailControlDept.html',
      chunks: ['partDetailControlDept', 'vendor', 'common'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'nursing',
      template: path.resolve(__dirname, 'src/html', 'nursing.html'),
      filename: 'nursing.html',
      chunks: ['nursing', 'vendor', 'common','scrollBar'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'error',
      template: path.resolve(__dirname, 'src/html', 'error.html'),
      filename: 'error.html',
      chunks: ['error', 'vendor', 'common'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'console.html',
      template: path.resolve(__dirname, 'src/html', 'console.html'),
      filename: 'console.html',
      chunks: ['console', 'vendor', 'common','scrollBar'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'uncorrectedCopy.html',
      template: path.resolve(__dirname, 'src/html', 'uncorrectedCopy.html'),
      filename: 'uncorrectedCopy.html',
      chunks: ['uncorrectedCopy', 'vendor', 'common','scrollBar'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'pacs.html',
      template: path.resolve(__dirname, 'src/html', 'pacs.html'),
      filename: 'pacs.html',
      chunks: ['pacs', 'vendor', 'common','scrollBar'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'pacsDetail.html',
      template: path.resolve(__dirname, 'src/html', 'pacsDetail.html'),
      filename: 'pacsDetail.html',
      chunks: ['pacsDetail', 'vendor', 'common','scrollBar'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'assist.html',
      template: path.resolve(__dirname, 'src/html', 'assist.html'),
      filename: 'assist.html',
      chunks: ['assist', 'vendor', 'common','scrollBar'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'advice.html',
      template: path.resolve(__dirname, 'src/html', 'advice.html'),
      filename: 'advice.html',
      chunks: ['advice', 'vendor', 'common'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'tiaomuControl.html',
      template: path.resolve(__dirname, 'src/html', 'tiaomuControl.html'),
      filename: 'tiaomuControl.html',
      chunks: ['tiaomuControl', 'vendor', 'common'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'checkControl.html',
      template: path.resolve(__dirname, 'src/html', 'checkControl.html'),
      filename: 'checkControl.html',
      chunks: ['checkControl', 'vendor', 'common'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'assertTypeDetail.html',
      template: path.resolve(__dirname, 'src/html', 'assertTypeDetail.html'),
      filename: 'assertTypeDetail.html',
      chunks: ['assertTypeDetail', 'vendor', 'common'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'assertType.html',
      template: path.resolve(__dirname, 'src/html', 'assertType.html'),
      filename: 'assertType.html',
      chunks: ['assertType', 'vendor', 'common'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'mukuaiControl.html',
      template: path.resolve(__dirname, 'src/html', 'mukuaiControl.html'),
      filename: 'mukuaiControl.html',
      chunks: ['mukuaiControl', 'vendor', 'common'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'quexianDetail.html',
      template: path.resolve(__dirname, 'src/html', 'quexianDetail.html'),
      filename: 'quexianDetail.html',
      chunks: ['quexianDetail', 'vendor', 'common'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'quexianDetailHome.html',
      template: path.resolve(__dirname, 'src/html', 'quexianDetailHome.html'),
      filename: 'quexianDetailHome.html',
      chunks: ['quexianDetailHome', 'vendor', 'common'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'quexianDetailControl.html',
      template: path.resolve(__dirname, 'src/html', 'quexianDetailControl.html'),
      filename: 'quexianDetailControl.html',
      chunks: ['quexianDetailControl', 'vendor', 'common'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'quexianDetailControlHome.html',
      template: path.resolve(__dirname, 'src/html', 'quexianDetailControlHome.html'),
      filename: 'quexianDetailControlHome.html',
      chunks: ['quexianDetailControlHome', 'vendor', 'common'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'quexianXQ.html',
      template: path.resolve(__dirname, 'src/html', 'quexianXQ.html'),
      filename: 'quexianXQ.html',
      chunks: ['quexianXQ', 'vendor', 'common'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'partDetailControl.html',
      template: path.resolve(__dirname, 'src/html', 'partDetailControl.html'),
      filename: 'partDetailControl.html',
      chunks: ['partDetailControl', 'vendor', 'common'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'jiaji.html',
      template: path.resolve(__dirname, 'src/html', 'jiaji.html'),
      filename: 'jiaji.html',
      chunks: ['jiaji', 'vendor', 'common'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'abnormal.html',
      template: path.resolve(__dirname, 'src/html', 'abnormal.html'),
      filename: 'abnormal.html',
      chunks: ['abnormal', 'vendor', 'common'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'deptScoreDetailControl.html',
      template: path.resolve(__dirname, 'src/html', 'deptScoreDetailControl.html'),
      filename: 'deptScoreDetailControl.html',
      chunks: ['deptScoreDetailControl', 'vendor', 'common'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'payDetail.html',
      template: path.resolve(__dirname, 'src/html', 'payDetail.html'),
      filename: 'payDetail.html',
      chunks: ['payDetail', 'vendor', 'common'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'partDetail.html',
      template: path.resolve(__dirname, 'src/html', 'partDetail.html'),
      filename: 'partDetail.html',
      chunks: ['partDetail', 'vendor', 'common'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'dayDetail.html',
      template: path.resolve(__dirname, 'src/html', 'dayDetail.html'),
      filename: 'dayDetail.html',
      chunks: ['dayDetail', 'vendor', 'common'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'deptScoreDetail.html',
      template: path.resolve(__dirname, 'src/html', 'deptScoreDetail.html'),
      filename: 'deptScoreDetail.html',
      chunks: ['deptScoreDetail', 'vendor', 'common'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'deptConsole.html',
      template: path.resolve(__dirname, 'src/html', 'deptConsole.html'),
      filename: 'deptConsole.html',
      chunks: ['deptConsole', 'vendor', 'common'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'itemManager.html',
      template: path.resolve(__dirname, 'src/html', 'itemManager.html'),
      filename: 'itemManager.html',
      chunks: ['itemManager', 'vendor', 'common'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'moduleManager.html',
      template: path.resolve(__dirname, 'src/html', 'moduleManager.html'),
      filename: 'moduleManager.html',
      chunks: ['moduleManager', 'vendor', 'common'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'tiaomu.html',
      template: path.resolve(__dirname, 'src/html', 'tiaomu.html'),
      filename: 'tiaomu.html',
      chunks: ['tiaomu', 'vendor', 'common'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'mukuai.html',
      template: path.resolve(__dirname, 'src/html', 'mukuai.html'),
      filename: 'mukuai.html',
      chunks: ['mukuai', 'vendor', 'common'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'login.html',
      template: path.resolve(__dirname, 'src/html', 'login.html'),
      filename: 'login.html',
      chunks: ['login', 'vendor', 'common'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'qcList.html',
      template: path.resolve(__dirname, 'src/html', 'qcList.html'),
      filename: 'qcList.html',
      chunks: ['qcList', 'vendor', 'common'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'qcListCopy.html',
      template: path.resolve(__dirname, 'src/html', 'qcListCopy.html'),
      filename: 'qcListCopy.html',
      chunks: ['qcListCopy', 'vendor', 'common'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'qcListCopyquexian.html',
      template: path.resolve(__dirname, 'src/html', 'qcListCopyquexian.html'),
      filename: 'qcListCopyquexian.html',
      chunks: ['qcListCopyquexian', 'vendor', 'common'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'qcListCopyUnqualified.html',
      template: path.resolve(__dirname, 'src/html', 'qcListCopyUnqualified.html'),
      filename: 'qcListCopyUnqualified.html',
      chunks: ['qcListCopyUnqualified', 'vendor', 'common'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'qcListOutHospital.html',
      template: path.resolve(__dirname, 'src/html', 'qcListOutHospital.html'),
      filename: 'qcListOutHospital.html',
      chunks: ['qcListOutHospital', 'vendor', 'common'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'qcListDocteam.html',
      template: path.resolve(__dirname, 'src/html', 'qcListDocteam.html'),
      filename: 'qcListDocteam.html',
      chunks: ['qcListDocteam', 'vendor', 'common'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'qcListPerson.html',
      template: path.resolve(__dirname, 'src/html', 'qcListPerson.html'),
      filename: 'qcListPerson.html',
      chunks: ['qcListPerson', 'vendor', 'common'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'qcListDept.html',
      template: path.resolve(__dirname, 'src/html', 'qcListDept.html'),
      filename: 'qcListDept.html',
      chunks: ['qcListDept', 'vendor', 'common'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'qcScore.html',
      template: path.resolve(__dirname, 'src/html', 'qcScore.html'),
      filename: 'qcScore.html',
      chunks: [ 'qcScore','vendor', 'common'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'statistics.html',
      template: path.resolve(__dirname, 'src/html', 'statistics.html'),
      filename: 'statistics.html',
      chunks: ['index', 'vendor', 'common'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'userManager.html',
      template: path.resolve(__dirname, 'src/html', 'userManager.html'),
      filename: 'userManager.html',
      chunks: ['userManager', 'vendor', 'common'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'roleManager.html',
      template: path.resolve(__dirname, 'src/html', 'roleManager.html'),
      filename: 'roleManager.html',
      chunks: ['roleManager', 'vendor', 'common'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'singleVeto.html', //单项否决详情页
      template: path.resolve(__dirname, 'src/html', 'singleVeto.html'),
      filename: 'singleVeto.html',
      chunks: ['singleVeto', 'vendor', 'common'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'itemDefectDetail.html', //单项否决详情页
      template: path.resolve(__dirname, 'src/html', 'itemDefectDetail.html'),
      filename: 'itemDefectDetail.html',
      chunks: ['itemDefectDetail', 'vendor', 'common'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'keyItemFlawControl.html', //关键条目缺陷占比
      template: path.resolve(__dirname, 'src/html', 'keyItemFlawControl.html'),
      filename: 'keyItemFlawControl.html',
      chunks: ['keyItemFlawControl', 'vendor', 'common'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'uncorrectedCasesStatistics.html', //未整改病历统计
      template: path.resolve(__dirname, 'src/html', 'uncorrectedCasesStatistics.html'),
      filename: 'uncorrectedCasesStatistics.html',
      chunks: ['uncorrectedCasesStatistics', 'vendor', 'common'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'uccDetail.html', //未整改病历统计_缺陷详情
      template: path.resolve(__dirname, 'src/html', 'uccDetail.html'),
      filename: 'uccDetail.html',
      chunks: ['uccDetail', 'vendor', 'common'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new HtmlWebpackPlugin({
      title: 'readmission.html', //未整改病历统计_缺陷详情
      template: path.resolve(__dirname, 'src/html', 'readmission.html'),
      filename: 'readmission.html',
      chunks: ['readmission', 'vendor', 'common'],
      hash: true, //防止缓存
      inject: true,
      minify: {
        removeAttributeQuotes: true, //压缩 去掉引号
        removeComments: true, //移除HTML中的注释
        collapseWhitespace: true //删除空白符与换行符
      }
    }),
    new CopyWebpackPlugin([
      {
        from:'src/resource',
        to:path.resolve(__dirname,'dist','resource'),
        flatten:true,   //false会拷贝原始文件夹路径
      }
    ]),
    new MiniCssExtractPlugin({
      filename: 'css/[name].css',
      chunkFilename: '[id].css'
    }),
    new webpack.HotModuleReplacementPlugin(),
    new CleanWebpackPlugin()
  ],
  optimization: { //webpack4.x的最新优化配置项，用于提取公共代码
    minimizer: [
      new UglifyJsPlugin({
        uglifyOptions: {
          ie8: true,
          compress: {
            properties: false,
            warnings: false
          },
          mangle: {
            screw_ie8: false,
            except: ['e']
          },
          output: {
              beautify: true
          },
          sourceMap: false
        }
      })
    ],
    splitChunks: {
      cacheGroups: {
        commons: {
          chunks: "initial",
          name: "common",
          minChunks: 2,
          maxInitialRequests: 5, // The default limit is too small to showcase the effect
          minSize: 0, // This is example is too small to create commons chunks
          reuseExistingChunk: true // 可设置是否重用该chunk
        }
      }
    }
  },
      
  module: {
    noParse: /WdatePicker/,
    rules: [
      {
          test: /.js$/,
          enforce: 'post', 
          loader: 'es3ify-loader'
      },
      {
        test: /\.m?js$/,
        exclude: /(node_modules|bower_components)/,
        use: {
          loader: 'babel-loader',
          options: {
            presets:['@babel/preset-env']
          }
        }
      },
      {
        test: /\.css$/,
        use: [{
            loader: MiniCssExtractPlugin.loader
          },
          'css-loader'
        ]
      },
      {
        test: /\.less$/,
        use: [{
            loader: MiniCssExtractPlugin.loader
          },
          'css-loader', 'less-loader'
        ]
      },
      {
        test:/\.(png|gif|jpg|jpeg|svg|eot|ttf|woff|woff2)$/,
        use:[{
          loader:'url-loader',
          options:{
            limit:10240,
            esModule:false,
            name:'[name]_[hash:6].[ext]',
            outputPath:'images/'
          }
        }],
        exclude:/node_modules/
      },{
        test:/.html$/,
        use:'html-withimg-loader'
      }
    ]
  },
  // devtool: 'cheap-module-eval-source-map', //开发环境cheap-module-eval-source-map   //生产环境cheap-module-source-map
  mode: 'development',
  devServer: {
    contentBase: "./dist", //静态文件根目录
    proxy: {
      '/': proxyHost
    },
    hot: true,
    openPage:'login.html'
  }
}