text: const path = require('path')
  const webpack = require('webpack')
  const ExtractTextPlugin = require('extract-text-webpack-plugin')
  let FriendlyErrorsPlugin
  
  const config = require('../config')
  
  if(!config.isProd) {
    FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
  }
  
  module.exports = {
    entry: {
      app: ['./src/index.js']
    },
    devtool: config.isProd
      ? false
      : '#cheap-module-source-map',
    output: {
      path: config.build.assetsRoot,
      filename: '[name].js',
      publicPath: config.isProd
        ? config.build.assetsPublicPath
        : config.dev.assetsPublicPath
    },
    resolve: {
      alias: {
        '@': path.resolve(__dirname, '../src')
      }
    },
    module: {
      rules: [
        {
          test: /^((?!spec).)*\.(js)$/,
          loader: 'eslint-loader',
          enforce: 'pre',
          include: [path.resolve(__dirname, '../src')],
          options: {
            formatter: require('eslint-friendly-formatter')
          }
        },
        {
          test: /\.js$/,
          loader: 'babel-loader',
          exclude: /node_modules/
        },
        {
          test: /\.(png|jpg|gif|svg)$/,
          loader: 'url-loader',
          options: {
            limit: 10000,
            name: '[name].[ext]?[hash]'
          }
        },
        {
          test: /\.css$/,
          use: config.isProd
            ? ExtractTextPlugin.extract({
                use: 'css-loader?minimize'
              })
            : ['style-loader', 'css-loader']
        }/*,
        {
          test: /\.(eot|svg|ttf|woff|woff2)$/,
          loader: 'file-loader',
        },
        {
          test: /\.(jpg|png|gif)$/,
          loaders: [
            'file-loader',
            {
              loader: 'image-webpack-loader',
              query: {
                progressive: true,
                optimizationLevel: 7,
                interlaced: false,
                pngquant: {
                  quality: '65-90',
                  speed: 4,
                },
              },
            },
          ],
        }*/
      ]
    },
    plugins: config.isProd
      ? [
          new webpack.optimize.UglifyJsPlugin({
            compress: { warnings: false }
          }),
          new ExtractTextPlugin({
            filename: 'common.[chunkhash].css'
          })
        ]
      : [
          new FriendlyErrorsPlugin()
        ]
  }
  