2015-09-02 15:08:58 -04:00
|
|
|
var path = require('path');
|
|
|
|
var webpack = require('webpack');
|
2015-10-13 15:40:51 -04:00
|
|
|
|
2015-09-04 01:26:56 -04:00
|
|
|
var routes = require('./server/routes.json');
|
2015-09-02 15:08:58 -04:00
|
|
|
|
2015-09-04 01:26:56 -04:00
|
|
|
// Prepare all entry points
|
|
|
|
var entry = {
|
2015-10-16 11:02:23 -04:00
|
|
|
init: './src/init.js',
|
2015-09-04 01:26:56 -04:00
|
|
|
main: './src/main.jsx'
|
|
|
|
};
|
|
|
|
routes.forEach(function (route) {
|
2015-09-14 16:03:39 -04:00
|
|
|
if ( ! route.static ) {
|
|
|
|
entry[route.view] = './src/views/' + route.view + '/' + route.view + '.jsx';
|
|
|
|
}
|
2015-09-04 01:26:56 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
// Config
|
2015-09-02 15:08:58 -04:00
|
|
|
module.exports = {
|
2015-09-04 01:26:56 -04:00
|
|
|
entry: entry,
|
2015-09-02 15:08:58 -04:00
|
|
|
devtool: 'source-map',
|
|
|
|
externals: {
|
|
|
|
'react': 'React',
|
2015-10-14 22:58:32 -04:00
|
|
|
'react/addons': 'React',
|
|
|
|
'react-dom': 'ReactDOM'
|
2015-09-02 15:08:58 -04:00
|
|
|
},
|
|
|
|
output: {
|
|
|
|
path: path.resolve(__dirname, 'build/js'),
|
|
|
|
filename: '[name].bundle.js'
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
loaders: [
|
|
|
|
{
|
|
|
|
test: /\.jsx$/,
|
|
|
|
loader: 'jsx-loader',
|
|
|
|
include: path.resolve(__dirname, 'src')
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.json$/,
|
2015-10-16 15:09:06 -04:00
|
|
|
loader: 'json-loader'
|
2015-09-02 15:08:58 -04:00
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.scss$/,
|
2015-09-08 14:56:28 -04:00
|
|
|
loader: 'style!css!autoprefixer-loader?browsers=last 3 versions!sass'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.(png|jpg|gif|eot|svg|ttf|woff)$/,
|
|
|
|
loader: 'url-loader'
|
2015-09-02 15:08:58 -04:00
|
|
|
}
|
|
|
|
]
|
2015-09-02 16:33:31 -04:00
|
|
|
},
|
2015-10-07 11:29:17 -04:00
|
|
|
node: {
|
|
|
|
fs: 'empty'
|
|
|
|
},
|
2015-09-02 16:33:31 -04:00
|
|
|
plugins: [
|
|
|
|
new webpack.optimize.UglifyJsPlugin({
|
|
|
|
compress: {
|
|
|
|
warnings: false
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
new webpack.optimize.OccurenceOrderPlugin(),
|
|
|
|
new webpack.optimize.DedupePlugin()
|
|
|
|
]
|
2015-09-02 15:08:58 -04:00
|
|
|
};
|