This repository was archived by the owner on Nov 5, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -50,8 +50,12 @@ export const typescriptVersion = "${typeScriptDependencyVersion}";\n`
50
50
// \/[*/] matches the start of a comment (single or multi-line).
51
51
// ^\s+\*[^/] matches (presumably) a later line of a multi-line comment.
52
52
const tsServicesNoCommentedRequire = tsServices . replace ( / ( \/ [ * / ] | ^ \s + \* [ ^ / ] ) .* \b r e q u i r e \( .* / gm, '' ) ;
53
- const linesWithRequire = tsServicesNoCommentedRequire . match ( / ^ .* ?\b r e q u i r e \( .* $ / gm) ;
54
- if ( linesWithRequire && linesWithRequire . length ) {
53
+ const linesWithRequire = tsServicesNoCommentedRequire . match ( / ^ .* ?\b r e q u i r e \( .* $ / gm)
54
+
55
+ // Allow error messages to include references to require() in their strings
56
+ const runtimeRequires = linesWithRequire && linesWithRequire . filter ( l => ! l . includes ( ": diag(" ) )
57
+
58
+ if ( runtimeRequires && runtimeRequires . length && linesWithRequire ) {
55
59
console . error ( 'Found new require() calls on the following lines. These should be removed to avoid breaking webpack builds.\n' ) ;
56
60
console . error ( linesWithRequire . join ( '\n' ) ) ;
57
61
process . exit ( 1 ) ;
You can’t perform that action at this time.
0 commit comments