/*
 * Webpack distribution configuration
 *
 * This file is set up for serving the distribution version. It will be compiled to dist/ by default
 */

'use strict';

var webpack = require('webpack');

module.exports = {

  output: {
    publicPath: '/assets/',
    path: 'dist/assets/',
    filename: 'main.js'
  },

  debug: false,
  devtool: false,
  entry: './src/components/<% if (reactRouter) { %>main<% } else { %><%= scriptAppName %><% } %>.js',

  stats: {
    colors: true,
    reasons: false
  },

  plugins: [
    new webpack.optimize.DedupePlugin(),
    new webpack.optimize.UglifyJsPlugin(),
    new webpack.optimize.OccurenceOrderPlugin(),
    new webpack.optimize.AggressiveMergingPlugin()
  ],

  resolve: {
    extensions: ['', '.js'],
    alias: {
      'styles': __dirname + '/src/styles',
      'mixins': __dirname + '/src/mixins',
      'components': __dirname + '/src/components/'<% if(architecture==='flux'||architecture=='reflux') { %>,
      'stores': __dirname + '/src/stores/',
      'actions': __dirname + '/src/actions/'<% } %>
    }
  },

  module: {
    preLoaders: [{
      test: /\.js$/,
      exclude: /node_modules/,
      loader: 'jsxhint'
    }],

    loaders: [{
      test: /\.js$/,
      exclude: /node_modules/,
      loader: 'babel-loader'
    }, {
      test: /\.css$/,
      loader: 'style-loader!css-loader'
    },<% if (stylesLanguage === 'sass') { %> {
      test: /\.sass/,
      loader: 'style-loader!css-loader!sass-loader?outputStyle=expanded&indentedSyntax'
    },<% } %><% if (stylesLanguage === 'scss') { %> {
      test: /\.scss/,
      loader: 'style-loader!css-loader!sass-loader?outputStyle=expanded'
    },<% } %><% if (stylesLanguage === 'less') { %> {
      test: /\.less/,
      loader: 'style-loader!css-loader!less-loader'
    },<% } %><% if (stylesLanguage === 'stylus') { %> {
      test: /\.styl/,
      loader: 'style-loader!stylus-loader!less-loader'
    },<% } %> {
      test: /\.(png|jpg)$/,
      loader: 'url-loader?limit=8192'
    }]
  }
};

@@ -191,16 +191,56 @@
 bpack');
+%0Avar alias = require('./webpack.alias');
 %0A%0Amodule
@@ -800,306 +800,13 @@
 as: 
-%7B%0A      'styles': __dirname + '/src/styles',%0A      'mixins': __dirname + '/src/mixins',%0A      'components': __dirname + '/src/components/'%3C%25 if(architecture==='flux'%7C%7Carchitecture=='reflux') %7B %25%3E,%0A      'stores': __dirname + '/src/stores/',%0A      'actions': __dirname + '/src/actions/'%3C%25 %7D %25%3E%0A    %7D
+alias
 %0A  %7D

update webpack.dist.config to have alias variable