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

Commit a6dea20

Browse files
committed
Allow error messages to contain references to require in their strings
1 parent 61a0941 commit a6dea20

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

scripts/importTypescript.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ export const typescriptVersion = "${typeScriptDependencyVersion}";\n`
5050
// \/[*/] matches the start of a comment (single or multi-line).
5151
// ^\s+\*[^/] matches (presumably) a later line of a multi-line comment.
5252
const tsServicesNoCommentedRequire = tsServices.replace(/(\/[*/]|^\s+\*[^/]).*\brequire\(.*/gm, '');
53-
const linesWithRequire = tsServicesNoCommentedRequire.match(/^.*?\brequire\(.*$/gm);
53+
const linesWithRequire = tsServicesNoCommentedRequire.match(/^.*?\brequire\(.*$/gm)
54+
.filter(l => !l.includes(": diag(")) // Allow error messages to include references to require() in their strings
55+
5456
if (linesWithRequire && linesWithRequire.length) {
5557
console.error('Found new require() calls on the following lines. These should be removed to avoid breaking webpack builds.\n');
5658
console.error(linesWithRequire.join('\n'));

0 commit comments

Comments
 (0)