add webpack configs and gulp webpack build tasks

This commit is contained in:
Berkeley Martinez
2015-07-01 15:04:13 -07:00
parent 85cf79f3d4
commit 07fc22f86a
3 changed files with 10 additions and 10 deletions

View File

@ -1,4 +1,4 @@
require('babel/register'); require('babel-core/register');
var gulp = require('gulp'), var gulp = require('gulp'),
path = require('path'), path = require('path'),
@ -54,7 +54,7 @@ var paths = {
node: { node: {
src: './client', src: './client',
dest: 'server/server' dest: 'common/app'
}, },
syncWatch: [ syncWatch: [
@ -100,15 +100,15 @@ gulp.task('loopback', function() {
}); });
gulp.task('pack-client', function() { gulp.task('pack-client', function() {
return gulp.src(paths.client.src) return gulp.src(webpackConfig.entry)
.pipe(webpack(webpackConfig)) .pipe(webpack(webpackConfig))
.pipe(gulp.dest(paths.client.dest)); .pipe(gulp.dest(webpackConfig.output.path));
}); });
gulp.task('pack-node', function() { gulp.task('pack-node', function() {
return gulp.src(paths.node.src) return gulp.src(webpackConfigNode.entry)
.pipe(webpack(webpackConfigNode)) .pipe(webpack(webpackConfigNode))
.pipe(gulp.dest(paths.node.dest)); .pipe(gulp.dest(webpackConfigNode.output.path));
}); });
gulp.task('pack', ['pack-client', 'pack-node']); gulp.task('pack', ['pack-client', 'pack-node']);

View File

@ -4,7 +4,7 @@ module.exports = {
devtool: 'sourcemap', devtool: 'sourcemap',
entry: './client', entry: './client',
output: { output: {
filename: 'fcc.js', filename: 'bundle.js',
path: path.join(__dirname, '/public/js'), path: path.join(__dirname, '/public/js'),
publicPath: 'public/' publicPath: 'public/'
}, },

View File

@ -14,12 +14,12 @@ var nodeModules = fs.readdirSync('node_modules')
module.exports = { module.exports = {
devtool: 'sourcemap', devtool: 'sourcemap',
target: 'node', target: 'node',
entry: './server/appEntry', entry: './common/app',
// keeps webpack from bundling modules // keeps webpack from bundling modules
externals: nodeModules, externals: nodeModules,
output: { output: {
filename: 'fcc.js', filename: 'app-stream.bundle.js',
path: path.join(__dirname, '/public/js'), path: path.join(__dirname, '/server'),
publicPath: 'public/' publicPath: 'public/'
}, },
module: { module: {