Skip to content

Typescript build error file location #12647

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
julianklumpers opened this issue Aug 9, 2022 · 9 comments
Open

Typescript build error file location #12647

julianklumpers opened this issue Aug 9, 2022 · 9 comments

Comments

@julianklumpers
Copy link

Hi,

When building my app, when there is a TS error, it does not report the location of the file where the error is. We have a big repo, and it is a real pain to locate this error. Am I missing something?

Screenshot 2022-08-09 at 13 04 39

@mwisnicki
Copy link

Same, it's very annoying.

@codeguru42
Copy link

I just encountered this as well. Text search in the project helps to narrow it down, but sometimes the same line of code appears in multiple places.

@tommck
Copy link

tommck commented May 10, 2023

I have been having this problem for a while now. I'm new to React, so I thought it was pilot error, but I'm astonished that this isn't a higher priority. Is it rare to run across this?

@sahendrickson
Copy link

I don't get file names either. Are there plans to fix this? Is there a workaround?

@dennis-8
Copy link

Please fix it...

@c-bik
Copy link

c-bik commented Jun 8, 2024

+1

@trapgar
Copy link

trapgar commented Jan 27, 2025

This is still an issue 2 and-a-half years later! Though to be fair, the latest version of react-scripts was published 3 years ago... 🙄

Is this even under maintenance anymore? I'm not seeing any code changes in a long time; have all been docs/pipeline, but I am seeing at least 1 PR that addresses this issue.

@shimondoodkin
Copy link

+1

@shimondoodkin
Copy link

the build script was truncating the error message

main...shimondoodkin:create-react-app:shimondoodkin-error-filename

just edit the file
node_modules\react-scripts\scripts\build.js

about lines 173, make it like following, add for loop instead just if , then, length =1

  if (messages.errors.length) {
    // Only keep the first error. Others are often indicative
    // of the same problem, but confuse the reader with noise.
    const re = /\S+:\d+:\d+/;  // check if error message has filename with line number
    for(let i = 0; i < messages.errors.length; i++) {
      if(re.test(messages.errors[i])) {
        messages.errors.length = i+1; 
        break;
      }
    }
    return reject(new Error(messages.errors.join('\n\n')));
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants