add react build script

pull/1382/head
Berkeley Martinez 2015-07-25 09:02:56 -07:00
parent 38cb4b2873
commit 4bacd87943
3 changed files with 16 additions and 4 deletions

View File

@ -62,6 +62,10 @@ var paths = {
]
};
var webpackOptions = {
devtool: 'inline-source-map'
};
function errorHandler() {
var args = Array.prototype.slice.call(arguments);
@ -87,14 +91,22 @@ gulp.task('inject', function() {
gulp.task('pack-client', function() {
return gulp.src(webpackConfig.entry)
.pipe(plumber({ errorHandler }))
.pipe(webpack(webpackConfig))
.pipe(webpack(Object.assign(
{},
webpackConfig,
webpackOptions
)))
.pipe(gulp.dest(webpackConfig.output.path));
});
gulp.task('pack-watch', function() {
return gulp.src(webpackConfig.entry)
.pipe(plumber({ errorHandler }))
.pipe(webpack(Object.assign(webpackConfig, { watch: true })))
.pipe(webpack(Object.assign(
{},
webpackConfig,
{ watch: true }
)))
.pipe(gulp.dest(webpackConfig.output.path));
});

View File

@ -6,8 +6,9 @@
"url": "https://github.com/freecodecamp/freecodecamp.git"
},
"scripts": {
"build-production": "webpack",
"start": "babel-node server/server.js",
"prestart-production": "bower cache clean && bower install && gulp build",
"prestart-production": "bower cache clean && bower install && gulp build && npm run build-production",
"start-production": "node pm2Start",
"lint": "eslint --ext=.js,.jsx .",
"test": "mocha"

View File

@ -1,7 +1,6 @@
var path = require('path');
module.exports = {
devtool: 'inline-source-map',
entry: './client',
output: {
filename: 'bundle.js',