const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin')

module.exports = {
  //devtool: 'cheap-module-eval-source-map',
  
  entry: {
    contact: './src/contact/index.js',
    framework: ['react','react-dom','redux','react-redux'],
    staff:'./src/staff/index.js',
    workbench:'./src/workbench/index.js',
    hr:'./src/human-resource/index.js',
    product:'./src/product/index.js',
  },
  // output: {
  //   filename: 'js/bundle.js',
  //   path: path.resolve(__dirname, '../dist')
  // },

  module: {
    rules: [
      {
        test: /\.(js|jsx)$/,
        use: 'babel-loader',
        exclude: /node_modules/,
      },
      {
        test: /\.(jpg|png|gif)$/,
        use: {
          loader: 'url-loader',
          options: {
            name: '[name].[ext]',
            outputPath: 'images/',
            limit: 8192,
          },
        }
      }
  
      // {
      //   test: /\.css$/,
      //   use: [
      //     {
      //       loader:'style-loader',
      //       options:{
      //         insert:'top'
      //       }
      //     },
      //     'css-loader'],
      // },
      // {
      //   test: /\.(eot|woff)$/, loader: "file-loader"
      // }
    ]
  },

  plugins: [
    new HtmlWebpackPlugin({
      template: 'public/sub_index.html',
      filename: 'contact/index.html',
      chunks:['contact','framework']
    }),
    new HtmlWebpackPlugin({
      template: 'public/sub_index.html',
      filename: 'staff/index.html',
      chunks:['staff','framework']
    }),
    new HtmlWebpackPlugin({
      template: 'public/sub_index.html',
      filename: 'hr/index.html',
      chunks:['hr','framework']
    }),
    new HtmlWebpackPlugin({
      template: 'public/sub_index.html',
      filename: 'product/index.html',
      chunks:['product','framework']
    }),
  ]



}
