text: 'use strict';
  require('dotenv').config();
  require('./assert-env');
  
  const CopyWebpackPlugin = require('copy-webpack-plugin')
  const { DefinePlugin } = require('webpack');
  const HtmlWebpackPlugin = require('html-webpack-plugin');
  
  const production = process.env.NODE_ENV === 'production';
  
  const webpackConfig = module.exports = {};
  
  webpackConfig.entry = `${__dirname}/src/main.js`;
  webpackConfig.output = {
    filename: '[name].[hash].js',
    path: `${__dirname}/build`,
  };
  
  webpackConfig.plugins = [
    new HtmlWebpackPlugin({
      title: 'React App',
      template: `${__dirname}/src/index.html`,
    }),
    new CopyWebpackPlugin([
      // relative path is from src
      { from: 'public/assets/favicon.ico' }, // <- your path to favicon
    ]),
  
    new DefinePlugin({
      __DEBUG__: JSON.stringify(!production),
      __API_URL__: JSON.stringify(process.env.DEV_API_URL),
      __GOOGLE_CLIENT_ID__: JSON.stringify(process.env.GOOGLE_CLIENT_ID),
    }),
  ];
  
  webpackConfig.module = {};
  
  webpackConfig.module.rules = [
    {
      test: /\.(jpg|gif|png|svg)$/,
      use: [
        'file-loader',
      ],
    },
    {
      test: /\.js/,
      exclude: /node_modules/,
      use: {
        loader: 'babel-loader',
        options: {
          presets: ['env', 'stage-0', 'react'],
          plugins: ['transform-react-jsx-source'],
          cacheDirectory: true,
        },
      },
    },
  ];