scratch-www/webpack.config.js

53 lines
1.2 KiB
JavaScript
Raw Normal View History

2015-09-02 15:08:58 -04:00
var path = require('path');
var webpack = require('webpack');
var routes = require('./server/routes.json');
2015-09-02 15:08:58 -04:00
// Prepare all entry points
var entry = {
main: './src/main.jsx'
};
routes.forEach(function (route) {
entry[route.view] = './src/views/' + route.view + '/' + route.view + '.jsx';
});
// Config
2015-09-02 15:08:58 -04:00
module.exports = {
entry: entry,
2015-09-02 15:08:58 -04:00
devtool: 'source-map',
externals: {
'react': 'React',
'react/addons': 'React'
},
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$/,
loader: 'json-loader',
include: path.resolve(__dirname, 'src')
},
{
test: /\.scss$/,
loader: 'style!css!sass'
}
]
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
};