Skip to content
This repository was archived by the owner on Jul 27, 2021. It is now read-only.

Commit 79d5e7c

Browse files
committed
refine babel function statement
1 parent 394fea9 commit 79d5e7c

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/transformers/babelSyntax.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,15 @@ function cleanStackTrace(message) {
1111

1212
function cleanMessage(message) {
1313
return message
14-
// match until the last semicolon followed by a space
15-
// this should match
16-
// linux => "(SyntaxError: )Unexpected token (5:11)"
17-
// windows => "(SyntaxError: C:/projects/index.js: )Unexpected token (5:11)"
14+
// match until the last semicolon followed by a space
15+
// this should match
16+
// linux => "(SyntaxError: )Unexpected token (5:11)"
17+
// windows => "(SyntaxError: C:/projects/index.js: )Unexpected token (5:11)"
1818
.replace(/^Module build failed.*:\s/, 'Syntax Error: ')
19-
.replace(/^ModuleBuildError.*:\s/, 'Syntax Error: ');
19+
// remove mini-css-extract-plugin loader tracing errors
20+
.replace(/^Syntax Error: ModuleBuildError:.*:\s/, '')
21+
// remove babel extra wording
22+
.replace('SyntaxError: ', '');
2023
}
2124

2225
function isBabelSyntaxError(e) {
@@ -36,4 +39,4 @@ function transform(error) {
3639
return error;
3740
}
3841

39-
module.exports = transform;
42+
module.exports = transform;

0 commit comments

Comments
 (0)