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

Commit 95376a0

Browse files
committed
Fix for the working case
1 parent a6dea20 commit 95376a0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

scripts/importTypescript.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,11 @@ export const typescriptVersion = "${typeScriptDependencyVersion}";\n`
5151
// ^\s+\*[^/] matches (presumably) a later line of a multi-line comment.
5252
const tsServicesNoCommentedRequire = tsServices.replace(/(\/[*/]|^\s+\*[^/]).*\brequire\(.*/gm, '');
5353
const linesWithRequire = tsServicesNoCommentedRequire.match(/^.*?\brequire\(.*$/gm)
54-
.filter(l => !l.includes(": diag(")) // Allow error messages to include references to require() in their strings
5554

56-
if (linesWithRequire && linesWithRequire.length) {
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.length) {
5759
console.error('Found new require() calls on the following lines. These should be removed to avoid breaking webpack builds.\n');
5860
console.error(linesWithRequire.join('\n'));
5961
process.exit(1);

0 commit comments

Comments
 (0)