From 9add2cf46557cfe77c1ccb5c157890d85af5304a Mon Sep 17 00:00:00 2001 From: Berkeley Martinez Date: Tue, 9 Jan 2018 06:41:18 -0800 Subject: [PATCH] style(gulpfile): Remove object assign --- gulpfile.js | 15 +++++------ webpack.frame-runner.js | 58 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 9 deletions(-) create mode 100644 webpack.frame-runner.js diff --git a/gulpfile.js b/gulpfile.js index d01d38fe10..55f6b0d38c 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,5 +1,4 @@ // enable debug for gulp -/* eslint-disable prefer-object-spread/prefer-object-spread */ process.env.DEBUG = process.env.DEBUG || 'fcc:*'; require('dotenv').load(); @@ -291,11 +290,10 @@ gulp.task('pack-client', function() { return gulp.src(webpackConfig.entry.bundle) .pipe(plumber({ errorHandler })) - .pipe(webpackStream(Object.assign( - {}, - webpackConfig, - webpackOptions - ))) + .pipe(webpackStream({ + ...webpackConfig, + ...webpackOptions + })) .pipe(gulpif(condition, gutil.noop(), uglify())) .pipe(gulp.dest(dest)); }); @@ -412,9 +410,8 @@ gulp.task('js', function() { }); -function collector(file, memo) { - return Object.assign({}, JSON.parse(file.contents), memo); -} +const collector = (file, memo) => + Object.assign(memo, JSON.parse(file.contents)); function done(manifest) { return sortKeys(manifest); diff --git a/webpack.frame-runner.js b/webpack.frame-runner.js new file mode 100644 index 0000000000..c7225b1a15 --- /dev/null +++ b/webpack.frame-runner.js @@ -0,0 +1,58 @@ +const webpack = require('webpack'); +const path = require('path'); + +const __DEV__ = process.env.NODE_ENV !== 'production'; + +module.exports = { + entry: { + 'frame-runner': './client/frame-runner.js' + }, + devtool: __DEV__ ? 'inline-source-map' : null, + node: { + // Mock Node.js modules that Babel require()s but that we don't + // particularly care about. + fs: 'empty', + module: 'empty', + net: 'empty' + }, + output: { + filename: '[name].js', + chunkFilename: '[name]-[name].js', + path: path.join(__dirname, '/public/js'), + publicPath: '/js' + }, + module: { + loaders: [ + { + test: /\.jsx?$/, + include: [ path.join(__dirname, 'client/') ], + loaders: [ 'babel' ] + } + ] + }, + externals: { + rx: 'Rx' + }, + plugins: [ + new webpack.DefinePlugin({ + 'process.env': { + NODE_ENV: JSON.stringify(__DEV__ ? 'development' : 'production') + }, + __DEVTOOLS__: !__DEV__ + }), + // Use browser version of visionmedia-debug + new webpack.NormalModuleReplacementPlugin( + /debug\/node/, + 'debug/src/browser' + ), + new webpack.optimize.DedupePlugin(), + new webpack.optimize.OccurenceOrderPlugin(true) + ] +}; + +if (__DEV__) { + module.exports.plugins.push( + // prevents build on error + new webpack.NoErrorsPlugin() + ); +}