Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Meta
create-react-app
Commits
93029f83
Commit
93029f83
authored
7 years ago
by
Joe Haddad
Committed by
GitHub
7 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Remove superfluous lodash usage (#2938)
parent
10c1f577
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
packages/react-dev-utils/printBuildError.js
+8
-11
packages/react-dev-utils/printBuildError.js
with
8 additions
and
11 deletions
+8
-11
packages/react-dev-utils/printBuildError.js
+
8
-
11
View file @
93029f83
...
@@ -9,12 +9,11 @@
...
@@ -9,12 +9,11 @@
'
use strict
'
;
'
use strict
'
;
const
get
=
require
(
'
lodash/get
'
);
const
chalk
=
require
(
'
chalk
'
);
const
chalk
=
require
(
'
chalk
'
);
module
.
exports
=
function
printBuildError
(
err
)
{
module
.
exports
=
function
printBuildError
(
err
)
{
const
message
=
get
(
err
,
'
message
'
)
;
const
message
=
err
!=
null
&&
err
.
message
;
const
stack
=
get
(
err
,
'
stack
'
)
;
const
stack
=
err
!=
null
&&
err
.
stack
;
// Add more helpful message for UglifyJs error
// Add more helpful message for UglifyJs error
if
(
if
(
...
@@ -23,24 +22,22 @@ module.exports = function printBuildError(err) {
...
@@ -23,24 +22,22 @@ module.exports = function printBuildError(err) {
message
.
indexOf
(
'
from UglifyJs
'
)
!==
-
1
message
.
indexOf
(
'
from UglifyJs
'
)
!==
-
1
)
{
)
{
try
{
try
{
const
matched
=
/Unexpected token:
(
.+
)\[(
.+
)
:
(
.+
)
,
(
.+
)\]\[
.+
\]
/
.
exec
(
const
matched
=
/
(
.+
)\[(
.+
)
:
(
.+
)
,
(
.+
)\]\[
.+
\]
/
.
exec
(
stack
);
stack
);
if
(
!
matched
)
{
if
(
!
matched
)
{
throw
new
Error
(
throw
new
Error
(
'
Using errors for control flow is bad.
'
);
"
The regex pattern is not matched. Maybe UglifyJs changed it's message?
"
);
}
}
const
problemPath
=
matched
[
2
];
const
problemPath
=
matched
[
2
];
const
line
=
matched
[
3
];
const
line
=
matched
[
3
];
const
column
=
matched
[
4
];
const
column
=
matched
[
4
];
console
.
log
(
console
.
log
(
'
Failed to minify the code from this file:
\n\n
'
,
'
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
'
'
\n
'
);
);
}
catch
(
ignored
)
{
}
catch
(
ignored
)
{
console
.
log
(
'
Failed to minify the
cod
e.
'
,
err
);
console
.
log
(
'
Failed to minify the
bundl
e.
'
,
err
);
}
}
console
.
log
(
'
Read more here: http://bit.ly/2tRViJ9
'
);
console
.
log
(
'
Read more here: http://bit.ly/2tRViJ9
'
);
}
else
{
}
else
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets