From 024b4d4fcd195919e73bcc3259ef84831d65883e Mon Sep 17 00:00:00 2001 From: Dan Abramov <dan.abramov@gmail.com> Date: Fri, 22 Jul 2016 11:09:56 +0100 Subject: [PATCH] Minor tweaks --- config/webpack.config.dev.js | 9 ++++----- scripts/start.js | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/config/webpack.config.dev.js b/config/webpack.config.dev.js index 4dfd587eb..65b3936cc 100644 --- a/config/webpack.config.dev.js +++ b/config/webpack.config.dev.js @@ -12,16 +12,15 @@ var autoprefixer = require('autoprefixer'); var webpack = require('webpack'); var HtmlWebpackPlugin = require('html-webpack-plugin'); -function isInDebugMode() { - return process.argv.some(function (item) { return item.indexOf('--debug-template') > -1 }); -} - // TODO: hide this behind a flag and eliminate dead code on eject. // This shouldn't be exposed to the user. var isInNodeModules = 'node_modules' === path.basename(path.resolve(path.join(__dirname, '..', '..'))); var relativePath = isInNodeModules ? '../../..' : '..'; -if (isInDebugMode()) { +var isInDebugMode = process.argv.some(arg => + arg.indexOf('--debug-template') > -1 +); +if (isInDebugMode) { relativePath = '../template'; } var srcPath = path.resolve(__dirname, relativePath, 'src'); diff --git a/scripts/start.js b/scripts/start.js index cab3bfae6..2032a526f 100644 --- a/scripts/start.js +++ b/scripts/start.js @@ -17,14 +17,13 @@ var config = require('../config/webpack.config.dev'); var execSync = require('child_process').execSync; var opn = require('opn'); -function isSmokeTest() { - return process.argv.some(function (item) { return item.indexOf('--smoke-test') > -1 }); -} - // TODO: hide this behind a flag and eliminate dead code on eject. // This shouldn't be exposed to the user. var handleCompile; -if (isSmokeTest()) { +var isSmokeTest = process.argv.some(arg => + arg.indexOf('--smoke-test') > -1 +); +if (isSmokeTest) { handleCompile = function (err, stats) { if (err || stats.hasErrors() || stats.hasWarnings()) { process.exit(1); -- GitLab