mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-23 15:47:53 -05:00
38c4566e2b
This will help for the conference urls, which will be sub-urls, all under `conference`
78 lines
2 KiB
JavaScript
78 lines
2 KiB
JavaScript
var autoprefixer = require('autoprefixer');
|
|
var CopyWebpackPlugin = require('copy-webpack-plugin');
|
|
var MustacheRendererPlugin = require('./mustache-renderer-webpack-plugin');
|
|
var path = require('path');
|
|
var webpack = require('webpack');
|
|
|
|
var routes = require('./src/routes.json');
|
|
|
|
// Prepare all entry points
|
|
var entry = {
|
|
init: './src/init.js'
|
|
};
|
|
routes.forEach(function (route) {
|
|
if (!route.redirect) {
|
|
entry[route.name] = './src/views/' + route.view + '.jsx';
|
|
}
|
|
});
|
|
|
|
// Config
|
|
module.exports = {
|
|
entry: entry,
|
|
devtool: 'source-map',
|
|
externals: {
|
|
'react': 'React',
|
|
'react/addons': 'React',
|
|
'react-dom': 'ReactDOM',
|
|
'react-intl': 'ReactIntl',
|
|
'redux': 'Redux'
|
|
},
|
|
output: {
|
|
path: path.resolve(__dirname, 'build'),
|
|
filename: 'js/[name].bundle.js'
|
|
},
|
|
module: {
|
|
loaders: [
|
|
{
|
|
test: /\.jsx$/,
|
|
loader: 'jsx-loader',
|
|
include: path.resolve(__dirname, 'src')
|
|
},
|
|
{
|
|
test: /\.json$/,
|
|
loader: 'json-loader'
|
|
},
|
|
{
|
|
test: /\.scss$/,
|
|
loader: 'style!css!postcss-loader!sass'
|
|
},
|
|
{
|
|
test: /\.(png|jpg|gif|eot|svg|ttf|woff)$/,
|
|
loader: 'url-loader'
|
|
}
|
|
]
|
|
},
|
|
postcss: function () {
|
|
return [autoprefixer({browsers: ['last 3 versions']})];
|
|
},
|
|
node: {
|
|
fs: 'empty'
|
|
},
|
|
plugins: [
|
|
new MustacheRendererPlugin({
|
|
templatePath: path.resolve(__dirname, './src/template.html'),
|
|
routes: routes,
|
|
config: require('./src/template-config.js')
|
|
}),
|
|
new CopyWebpackPlugin([
|
|
{from: 'static'},
|
|
{from: 'intl', to: 'js'}
|
|
]),
|
|
new webpack.optimize.UglifyJsPlugin({
|
|
compress: {
|
|
warnings: false
|
|
}
|
|
}),
|
|
new webpack.optimize.OccurenceOrderPlugin()
|
|
]
|
|
};
|