var path = require('path');
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var CopyWebpackPlugin = require('copy-webpack-plugin');
var ExtractTextPlugin = require("extract-text-webpack-plugin");

var HtmlWebpackPluginConfig = new HtmlWebpackPlugin({
  template: __dirname + '/app/index.html',
  filename: 'index.html',
  inject: 'body'
});

var config = {
  devtool: 'cheap-module-source-map',

  entry: [
    path.resolve(__dirname, 'app/main.js'),
    path.resolve(__dirname, 'app/assets/scss/main.scss')
  ],

  output: {
    filename: 'bundle.js',
    path: path.resolve(__dirname, 'dist')
  },

  devServer: {
    outputPath: path.join(__dirname, 'dist')
  },

  module: {
    loaders: [
      {
        test: /\.js?$/,
        include: path.resolve(__dirname, 'app'),
        exclude: /node_modules/,
        loader: 'babel'
      },
      {
        test: /\.scss$/,
        loader: ExtractTextPlugin.extract({ fallbackLoader: 'style-loader', loader: 'css-loader!sass-loader'})
      }
    ]
  },

  plugins: [
    HtmlWebpackPluginConfig,
    new webpack.optimize.OccurenceOrderPlugin(),
    new webpack.optimize.UglifyJsPlugin({comments: false}),
    new webpack.DefinePlugin({ 'process.env': { NODE_ENV: JSON.stringify('production') } }),
    new ExtractTextPlugin("style.css", {allChunks: false}),
    new CopyWebpackPlugin([{ from: 'app/vendors', to: 'vendors' }])
  ]
};

module.exports = config;
@@ -1,16 +1,23 @@
 var 
-path
+%7B resolve %7D
  = requi
@@ -247,33 +247,280 @@
 var 
-HtmlWebpackPluginConfig =
+config = %7B%0A  devtool: 'cheap-module-source-map',%0A%0A  entry: %5B%0A    './main.js',%0A    './assets/scss/main.scss'%0A  %5D,%0A%0A  context: resolve(__dirname, 'app'),%0A%0A  output: %7B%0A    filename: 'bundle.js',%0A    path: resolve(__dirname, 'dist'),%0A    publicPath: '',%0A  %7D,%0A%0A  plugins: %5B%0A   
  new
@@ -540,16 +540,20 @@
 lugin(%7B%0A
+    
   templa
@@ -587,16 +587,20 @@
 .html',%0A
+    
   filena
@@ -617,16 +617,20 @@
 .html',%0A
+    
   inject
@@ -642,335 +642,623 @@
 dy'%0A
-%7D);%0A%0Avar config = %7B%0A  devtool: 'cheap-module-source-map',%0A%0A  entry: %5B%0A    path.resolve(__dirname, 'app/main.js'),%0A    path.resolve(__dirname, 'app/assets/scss/main.scss')%0A  %5D,%0A%0A  output: %7B%0A    filename: 'bundle.js',%0A    path: path.resolve(__dir
+    %7D),%0A    new webpack.optimize.OccurrenceOrderPlugin(),%0A    new webpack.LoaderOptionsPlugin(%7B%0A      minimize: true,%0A      debug: false%0A    %7D),%0A    new webpack.optimize.UglifyJsPlugin(%7B%0A      beautify: false,%0A      mangle: %7B%0A        screw_ie8: true,%0A        keep_fnames: true%0A      %7D,%0A      compress: %7B%0A        screw_ie8: true%0A      %7D,%0A      comments: false%0A    %7D),%0A    new webpack.DefinePlugin(%7B 'process.env': %7B NODE_ENV: JSON.stringify('production') %7D %7D),%0A    new ExtractTextPlugin(%7B file
 name
-, 'dist')%0A  %7D,%0A%0A  devServer: %7B%0A    outputPath: path.join(__dirname, 'dist'
+: 'style.css', disable: false, allChunks: true%7D),%0A    new CopyWebpackPlugin(%5B%7B from: './vendors', to: 'vendors' %7D%5D
 )%0A  
-%7D
+%5D
 ,%0A%0A 
@@ -1319,57 +1319,8 @@
 $/,%0A
-        include: path.resolve(__dirname, 'app'),%0A
     
@@ -1370,16 +1370,23 @@
 : 'babel
+-loader
 '%0A      
@@ -1417,24 +1417,57 @@
  /%5C.scss$/,%0A
+        exclude: /node_modules/,%0A
         load
@@ -1497,16 +1497,26 @@
 xtract(%7B
+%0A         
  fallbac
@@ -1524,17 +1524,17 @@
 Loader: 
-'
+%22
 style-lo
@@ -1541,33 +1541,45 @@
 ader
-', loader: 'css-loader!sa
+%22,%0A          loader: %5B%0A            'c
 ss-l
@@ -1588,406 +1588,119 @@
 der'
-%7D)
+,
 %0A      
-%7D%0A
     
-%5D%0A  %7D,%0A%0A  plugins: %5B%0A    HtmlWebpackPluginConfig,%0A    new webpack.optimize.OccurenceOrderPlugin(),%0A    new webpack.optimize.UglifyJsPlugin(%7Bcomments
+  %7B loader: 'sass-loader', query: %7B sourceMap
 : false
-%7D),
+ %7D %7D
 %0A    
-new webpack.DefinePlugin(%7B 'process.env': %7B NODE_ENV: JSON.stringify('production') %7D %7D),%0A    new ExtractTextPlugin(%22style.css%22, %7BallChunks: false
+      %5D%0A        
 %7D)
-,
 %0A    
-new CopyWebpackPlugin(%5B%7B from: 'app/vendors', to: 'vendors' %7D%5D)%0A  %5D
+  %7D,%0A    %5D%0A  %7D,
 %0A%7D;%0A

refactor the production build