From 93029f8368f346bc97a12a3d2d9b0b13d8c5a713 Mon Sep 17 00:00:00 2001
From: Joe Haddad <timer150@gmail.com>
Date: Thu, 10 Aug 2017 16:18:13 -0700
Subject: [PATCH] Remove superfluous lodash usage (#2938)

---
 packages/react-dev-utils/printBuildError.js | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/packages/react-dev-utils/printBuildError.js b/packages/react-dev-utils/printBuildError.js
index 208c708e1..eadfff471 100644
--- a/packages/react-dev-utils/printBuildError.js
+++ b/packages/react-dev-utils/printBuildError.js
@@ -9,12 +9,11 @@
 
 'use strict';
 
-const get = require('lodash/get');
 const chalk = require('chalk');
 
 module.exports = function printBuildError(err) {
-  const message = get(err, 'message');
-  const stack = get(err, 'stack');
+  const message = err != null && err.message;
+  const stack = err != null && err.stack;
 
   // Add more helpful message for UglifyJs error
   if (
@@ -23,24 +22,22 @@ module.exports = function printBuildError(err) {
     message.indexOf('from UglifyJs') !== -1
   ) {
     try {
-      const matched = /Unexpected token:(.+)\[(.+):(.+),(.+)\]\[.+\]/.exec(
-        stack
-      );
+      const matched = /(.+)\[(.+):(.+),(.+)\]\[.+\]/.exec(stack);
       if (!matched) {
-        throw new Error(
-          "The regex pattern is not matched. Maybe UglifyJs changed it's message?"
-        );
+        throw new Error('Using errors for control flow is bad.');
       }
       const problemPath = matched[2];
       const line = matched[3];
       const column = matched[4];
       console.log(
         'Failed to minify the code from this file: \n\n',
-        chalk.yellow(`${problemPath} line ${line}:${column}`),
+        chalk.yellow(
+          `\t${problemPath}:${line}${column !== '0' ? ':' + column : ''}`
+        ),
         '\n'
       );
     } catch (ignored) {
-      console.log('Failed to minify the code.', err);
+      console.log('Failed to minify the bundle.', err);
     }
     console.log('Read more here: http://bit.ly/2tRViJ9');
   } else {
-- 
GitLab