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() { function errorHandler() {
var args = Array.prototype.slice.call(arguments); var args = Array.prototype.slice.call(arguments);
@ -87,14 +91,22 @@ gulp.task('inject', function() {
gulp.task('pack-client', function() { gulp.task('pack-client', function() {
return gulp.src(webpackConfig.entry) return gulp.src(webpackConfig.entry)
.pipe(plumber({ errorHandler })) .pipe(plumber({ errorHandler }))
.pipe(webpack(webpackConfig)) .pipe(webpack(Object.assign(
{},
webpackConfig,
webpackOptions
)))
.pipe(gulp.dest(webpackConfig.output.path)); .pipe(gulp.dest(webpackConfig.output.path));
}); });
gulp.task('pack-watch', function() { gulp.task('pack-watch', function() {
return gulp.src(webpackConfig.entry) return gulp.src(webpackConfig.entry)
.pipe(plumber({ errorHandler })) .pipe(plumber({ errorHandler }))
.pipe(webpack(Object.assign(webpackConfig, { watch: true }))) .pipe(webpack(Object.assign(
{},
webpackConfig,
{ watch: true }
)))
.pipe(gulp.dest(webpackConfig.output.path)); .pipe(gulp.dest(webpackConfig.output.path));
}); });

View File

@ -6,8 +6,9 @@
"url": "https://github.com/freecodecamp/freecodecamp.git" "url": "https://github.com/freecodecamp/freecodecamp.git"
}, },
"scripts": { "scripts": {
"build-production": "webpack",
"start": "babel-node server/server.js", "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", "start-production": "node pm2Start",
"lint": "eslint --ext=.js,.jsx .", "lint": "eslint --ext=.js,.jsx .",
"test": "mocha" "test": "mocha"

View File

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