var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var CopyWebpackPlugin = require('copy-webpack-plugin');

var config = require("./story.json");
const path = require('path')

module.exports = [{
  context: __dirname,
  entry: {
    starter: getEntrySources([
      './index.js'
    ]),
  },
  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: "story.js"
  },
  module: {
    loaders: [{ test: /.js/, loaders: ['babel-loader?cacheDirectory']},
              { test: /\.json$/, loader: 'json-loader' },
              { test: /\.html$/, loader: 'html-loader'},
              { test: /\.hbs/, loader: 'handlebars-loader'}
    ]
  },
  plugins: [
    // Build our dist/index.html by reading from the config file and passing
    // those through to a template, written in Handlebars
    new HtmlWebpackPlugin({
      title: config.title,
      description: config.description,
      author: config.author,
      license: config.license,
      keywords: config.keywords,
      pagination: config.pagination,
      template: 'template.hbs'
    }),
    // Copy all static assets during a built to the dist/ directory.
    // If you add other directory names, they'll go in here.
    new CopyWebpackPlugin([
      { from: 'css', to: 'css' },
      { from: 'images', to: 'images' },
      { from: 'story.json'}
    ])
  ]
}];

function getEntrySources(sources) {
    if (process.env.NODE_ENV !== 'production') {
        sources.push('webpack-dev-server/client?http://localhost:8080');
    }
    return sources;
}

@@ -1,11 +1,13 @@
-var
+const
  webpack
@@ -29,19 +29,21 @@
 pack');%0A
-var
+const
  HtmlWeb
@@ -87,19 +87,21 @@
 ugin');%0A
-var
+const
  CopyWeb
@@ -149,75 +149,637 @@
 ');%0A
-%0Avar config = require(%22./story.json%22);%0Aconst path = require('path')
+const ExtractTextPlugin = require(%22extract-text-webpack-plugin%22);%0A%0Aconst config = require(%22./story.json%22);%0Aconst path = require('path')%0Aconst PROD = (process.env.NODE_ENV === 'production')%0A%0Avar prodPlugins = PROD ? %5B%0A    new webpack.optimize.UglifyJsPlugin(%7B%0A        compress: %7B%0A          warnings: false,%0A          screw_ie8: true%0A        %7D,%0A        comments: false%0A    %7D),%0A   new webpack.DefinePlugin(%7B%0A        %22process.env%22: %7B%0A            NODE_ENV: JSON.stringify(%22production%22)%0A           %7D%0A   %7D)%0A  %5D : %5Bnew webpack.DefinePlugin(%7B%0A        %22process.env%22: %7B%0A          NODE_ENV: JSON.stringify(%22develop%22)%0A        %7D%0A      %7D)%0A    %5D
 %0A%0Amo
@@ -1235,16 +1235,246 @@
 loader'%7D
+,%0A              %7B test: /%5C.woff(2)?(%5C?v=%5B0-9%5D%5C.%5B0-9%5D%5C.%5B0-9%5D)?$/, loader: %22url-loader?limit=10000&minetype=application/font-woff%22 %7D,%0A              %7B test: /%5C.(png%7Cjpg%7Cttf%7Ceot%7Csvg)(%5C?v=%5B0-9%5D%5C.%5B0-9%5D%5C.%5B0-9%5D)?$/, loader: %22file-loader%22%7D
 %0A    %5D%0A 
@@ -2158,16 +2158,36 @@
   %5D)%0A  %5D
+.concat(prodPlugins)
 %0A%7D%5D;%0A%0Afu
@@ -2232,45 +2232,13 @@
 if (
-process.env.NODE_ENV !== 'production'
+!PROD
 ) %7B%0A

Update with production build details from Harmonia