2015-12-20 15:19:50 -08:00
|
|
|
var webpack = require('webpack');
|
|
|
|
|
2016-01-09 18:39:09 -08:00
|
|
|
// Bundle entry point
|
2015-12-20 15:19:50 -08:00
|
|
|
var entry = ['./components/App.jsx'];
|
2016-01-09 18:39:09 -08:00
|
|
|
|
2016-01-16 17:57:16 -08:00
|
|
|
// However, do we want one full page, or single pages with react-router?
|
|
|
|
if(process.argv.indexOf("--singles") !== -1 ) {
|
|
|
|
entry = ['./pages/Routed.jsx'];
|
|
|
|
}
|
|
|
|
|
2016-01-09 18:39:09 -08:00
|
|
|
// Necessary webpack loaders for converting our content:
|
|
|
|
var webpackLoaders = [
|
|
|
|
'babel-loader',
|
2016-01-12 13:39:35 -08:00
|
|
|
'eslint',
|
2016-01-09 18:39:09 -08:00
|
|
|
__dirname + '/lib/latex-loader',
|
|
|
|
__dirname + '/lib/pre-loader',
|
|
|
|
__dirname + '/lib/p-loader'
|
|
|
|
];
|
|
|
|
|
2016-01-09 23:31:52 -08:00
|
|
|
var plugins = [];
|
|
|
|
|
2016-01-12 13:39:35 -08:00
|
|
|
// Dev mode: make certain concessions to speed up dev work.
|
|
|
|
if(process.argv.indexOf("--prod") === -1 && process.argv.indexOf("--lint")) {
|
2016-01-09 18:39:09 -08:00
|
|
|
// use the webpack hot Reload server:
|
2015-12-20 15:19:50 -08:00
|
|
|
entry.push('webpack/hot/dev-server');
|
2016-01-12 13:39:35 -08:00
|
|
|
// allow code in textareas when in dev mode:
|
2016-01-09 18:39:09 -08:00
|
|
|
webpackLoaders.push(__dirname + '/lib/textarea-loader');
|
2015-12-20 15:19:50 -08:00
|
|
|
}
|
|
|
|
|
2016-01-09 23:31:52 -08:00
|
|
|
// Prod mode: make sure to minify the bundle
|
2016-01-12 13:39:35 -08:00
|
|
|
else if(process.argv.indexOf("--prod") > -1) {
|
|
|
|
plugins.push(new webpack.optimize.UglifyJsPlugin());
|
|
|
|
}
|
2016-01-09 23:31:52 -08:00
|
|
|
|
2016-01-09 18:39:09 -08:00
|
|
|
// And the final config that webpack will read in.
|
2015-12-20 15:19:50 -08:00
|
|
|
module.exports = {
|
|
|
|
entry: entry,
|
|
|
|
output: {
|
|
|
|
path: __dirname,
|
|
|
|
filename: 'article.js'
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
loaders: [
|
2015-12-20 22:34:32 -08:00
|
|
|
{ test: /\.(png|gif)$/, loader: "file?name=images/packed/[hash].[ext]" },
|
2015-12-20 15:19:50 -08:00
|
|
|
{ test: /\.less$/, loader: "style!css!less" },
|
2016-01-12 18:55:20 -08:00
|
|
|
{ test: /\.json$/, loader: "json" },
|
2015-12-20 15:19:50 -08:00
|
|
|
{
|
|
|
|
test: /.jsx?$/,
|
2016-01-16 17:57:16 -08:00
|
|
|
include: /(components|pages)/,
|
2016-01-09 18:39:09 -08:00
|
|
|
loaders: webpackLoaders
|
2015-12-20 15:19:50 -08:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2016-01-12 13:39:35 -08:00
|
|
|
plugins: plugins,
|
|
|
|
eslint: {
|
|
|
|
configFile: __dirname + '/.eslintrc'
|
|
|
|
}
|
2015-12-23 08:08:32 -08:00
|
|
|
};
|