text: const path = require('path');
  const webpack = require('webpack');
  const merge = require('webpack-merge');
  const WebpackNotifierPlugin = require('webpack-notifier');
  const autoprefixer = require('autoprefixer');
  const precss = require('precss');
  const flexbugs = require('postcss-flexbugs-fixes');
  
  const libraryName = 'react-icons';
  
  const isProd = process.env.NODE_ENV === 'production';
  
  const PATHS = {
    root: __dirname,
    build: path.join(__dirname, 'lib', 'umd'),
    context: path.join(__dirname, 'src'),
    jsFileName: isProd ? `${libraryName}.min.js` : `${libraryName}.js`,
    entry: path.join(__dirname, 'src', 'index.js'),
  };
  
  /*
  * BASE CONFIG FOR ALL ENVS
  */
  const baseConfig = {
    context: PATHS.context,
    entry: [
      PATHS.entry,
    ],
    output: {
      path: PATHS.build,
      filename: PATHS.jsFileName,
      library: libraryName,
      libraryTarget: 'umd',
      umdNamedDefine: true,
    },
    module: {
      rules: [
        {
          test: /(\.jsx|\.js)$/,
          exclude: path.resolve(__dirname, 'node_modules'),
          use: [
            'babel-loader',
          ],
        },
        {
          test: /\.css$/,
          use: [
            'style-loader',
            'css-loader',
            {
              loader: 'postcss-loader',
              options: {
                plugins: () => [flexbugs, precss, autoprefixer],
                minimize: !!isProd,
              },
            },
          ],
        },
        {
          test: /\.scss$/,
          use: [
            'style-loader',
            'css-loader',
            {
              loader: 'postcss-loader',
              options: {
                plugins: () => [flexbugs, precss, autoprefixer],
                minimize: !!isProd,
              },
            },
            'sass-loader',
          ],
        },
        {
          test: /\.svg$/,
          exclude: path.resolve(__dirname, 'node_modules', 'font-awesome'),
          use: ['babel-loader', 'react-svg-loader'],
        },
        {
          test: /\.svg$/,
          include: path.resolve(__dirname, 'node_modules', 'font-awesome'),
          use: [{
            loader: 'file-loader',
            options: {
              name: '[name].[ext]',
              outputPath: 'fonts/',
            },
          }],
        },
        {
          test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/,
          use: [{
            loader: 'url-loader',
            options: {
              name: '[name].[ext]',
              outputPath: 'fonts/',
              limit: 100,
              mimetype: 'application/font-woff',
            },
          }],
        },
        {
          test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
          use: [{
            loader: 'url-loader',
            options: {
              name: '[name].[ext]',
              outputPath: 'fonts/',
              limit: 100,
              mimetype: 'application/octet-stream',
            },
          }],
        },
        {
          test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
          use: [{
            loader: 'file-loader',
            options: {
              name: '[name].[ext]',
              outputPath: 'fonts/',
            },
          }],
        },
        {
          test: /\.ico$/,
          use: [{
            loader: 'file-loader',
            options: {
              name: '[name].[ext]',
            },
          }],
        },
      ],
    },
    node: {
      fs: 'empty',
    },
    resolve: {
      modules: [
        path.resolve('./src'),
        'node_modules',
      ],
      extensions: ['.js', '.jsx'],
      mainFields: ['es', 'cjs', 'browser', 'module', 'es:next', 'main'],
    },
    // Add your peer dependencies here to avoid bundling them to build
    externals: {
      react: {
        root: 'React',
        commonjs2: 'react',
        commonjs: 'react',
        amd: 'react',
        umd: 'react',
      },
      'react-dom': {
        root: 'ReactDOM',
        commonjs2: 'react-dom',
        commonjs: 'react-dom',
        amd: 'react-dom',
        umd: 'react-dom',
      },
    },
  };
  
  /*
  * DEVELOPMENT CONFIG
  */
  const devConfig = {
    devtool: 'eval-source-map',
    plugins: [
      new webpack.DefinePlugin({
        'process.env': {
          NODE_ENV: JSON.stringify('development'),
        },
      }),
      new WebpackNotifierPlugin(),
      new webpack.NamedModulesPlugin(),
    ],
  };
  
  /*
  * PRODUCTION CONFIG
  */
  const prodConfig = {
    devtool: 'source-map',
    plugins: [
      new webpack.DefinePlugin({
        'process.env': {
          NODE_ENV: JSON.stringify('production'),
        },
      }),
      new webpack.optimize.ModuleConcatenationPlugin(),
      new webpack.optimize.UglifyJsPlugin({
        sourceMap: true,
        output: {
          comments: false,
        },
      }),
    ],
  };
  
  module.exports = merge(baseConfig, isProd ? prodConfig : devConfig);
  