mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-26 00:58:14 -05:00
52 lines
1.3 KiB
JavaScript
52 lines
1.3 KiB
JavaScript
var path = require('path');
|
|
var webpack = require('webpack');
|
|
var routes = require('./server/routes.json');
|
|
|
|
// 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
|
|
module.exports = {
|
|
entry: entry,
|
|
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!autoprefixer-loader?browsers=last 3 versions'
|
|
}
|
|
]
|
|
},
|
|
plugins: [
|
|
new webpack.optimize.UglifyJsPlugin({
|
|
compress: {
|
|
warnings: false
|
|
}
|
|
}),
|
|
new webpack.optimize.OccurenceOrderPlugin(),
|
|
new webpack.optimize.DedupePlugin()
|
|
]
|
|
};
|