text: const path = require('path')
  const ExtractTextPlugin = require('extract-text-webpack-plugin')
  const SvgStore = require('webpack-svgstore-plugin')
  const HtmlWebpackPlugin = require('html-webpack-plugin')
  const CopyWebpackPlugin = require('copy-webpack-plugin')
  
  module.exports = {
    entry: path.resolve('./src/index.js'),
    output: {
      path: path.resolve('./dist'),
      filename: 'bundle.js'
    },
    devServer: {
      port: 7070,
      historyApiFallback: true
    },
    module: {
      loaders: [
        {
          test: /\.json$/,
          loader: 'json-loader'
        },
        {
          test: /\.js?$/,
          exclude: /node_modules/,
          loader: 'babel-loader',
          query: {
            presets: ['react', 'es2015', 'stage-0']
          }
        }, {
          test: /\.scss$/,
          use: ExtractTextPlugin.extract({
            fallback: 'style-loader',
            use: [{
              loader: 'css-loader',
              options: {
                importLoaders: 1,
                modules: false,
                sourceMap: true
              }
            }, {
              loader: 'postcss-loader',
              options: {
                sourceMap: true
              }
            }, {
              loader: 'sass-loader',
              options: {
                sourceMap: true
              }
            }]
          })
        }, {
          test: /\.(jpe?g|png|gif)$/i,
          loader: 'file-loader',
          query: {
            name: 'images/[name]-[hash].[ext]?[hash]'
          }
        }, {
          test: /\.svg$/,
          loader: 'svg-inline-loader'
        }, {
          test: /\.(eot|ttf|woff|woff2)/,
          loader: 'file-loader',
          query: {
            name: 'fonts/[name].[ext]?[hash]'
          }
        }
      ]
    },
    plugins: [
      new CopyWebpackPlugin([
        {from: path.resolve(__dirname, './src/images'), to: path.resolve(__dirname, './dist/images')},
        {from: path.resolve(__dirname, './workeks'), to: path.resolve(__dirname, './dist/workers')}
      ]),
      new ExtractTextPlugin({filename: 'style.css', allChunks: true}),
      new SvgStore({svgoOptions: {plugins: [{removeTitle: true}]}, prefix: 'icon'}),
      new ExtractTextPlugin({filename: '[name].css'}),
      new HtmlWebpackPlugin({
        template: path.resolve(__dirname, './index.html'),
        inject: true,
        minify: {
          removeComments: true,
          collapseWhitespace: true,
          removeRedundantAttributes: true,
          useShortDoctype: true,
          removeEmptyAttributes: true,
          removeStyleLinkTypeAttributes: true,
          keepClosingSlash: true,
          minifyJS: true,
          minifyCSS: true,
          minifyURLs: true
        }
      })
    ]
  }
  