title: ReferenceError: webpack is not defined
body: <p>In my webpack app I have a basic build process that's triggered by "npm run build" which executes the webpack binary and copies my index.html in /app to /dist. Whenever I run <code>npm run build</code> I get <code>ReferenceError: webpack is not defined</code> but when I run <code>npm start</code>, which starts the webpack-dev-server, everything's fine.</p>
  
  <p>This is my webpack config file:</p>
  
  <pre><code>var ExtractTextPlugin = require('extract-text-webpack-plugin');
  
  var config = {
      context: __dirname + '/app',
      entry: './index.js',
      output: {
          path: __dirname + '/app',
          filename: 'app.js'
      },
      module: {
          loaders: [
              { test: /\.js$/, loader: 'babel', exclude: /node_modules/ },
              { test: /\.html$/, loader: 'raw', exclude: /node_modules/ },
              { test: /\.scss$/, loader: ExtractTextPlugin.extract('style', 'css!sass'), exclude: /node_modules/}
          ]
      },
      plugins: [
          new ExtractTextPlugin('app.css')
      ]
  };
  
  if (process.env.NODE_ENV == 'production') {
      config.output.path = __dirname + '/dist';
      config.plugins.push(new webpack.optimize.UglifyJsPlugin());
  }
  
  module.exports = config;
  </code></pre>