question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dev Server does not always show typescript compilation errors

See original GitHub issue

Describe the bug

React dev server does not consistently display typescript errors. Frequently, when running react-scripts start, the compiler does not display typescript errors and I only see them when running react-scripts build. I have noticed that this happens more frequently when there is a typescript error in files that have not been modified or when the dev server is consuming more CPU. Any ideas on why this happens and how to address it?

Did you try recovering your dependencies?

Yes

Which terms did you search for in User Guide?

“typescript errors” “typescript changes”

Environment

current version of create-react-app: 3.4.1

System: OS: macOS 11.2.1 CPU: (16) x64 Intel® Core™ i9-9880H CPU @ 2.30GHz Binaries: Node: 12.7.0 - /usr/local/bin/node Yarn: 1.22.10 - /usr/local/bin/yarn npm: 6.10.0 - /usr/local/bin/npm Browsers: Chrome: 89.0.4389.128 Firefox: 85.0.2 Safari: 14.0.3 npmPackages: react: 16.10 => 16.10.2 react-dom: 16.8.6 => 16.8.6 react-scripts: ^4.0.3 => 4.0.3 npmGlobalPackages: create-react-app: Not Found

Steps to reproduce

  1. Create a CRA typescript project of sufficient size (couple hundred files)
  2. Run dev server
  3. Trigger an error in a file you didn’t change

Expected behavior

Errors show up in the console

Actual behavior

Compiles without error

Reproducible demo

(Paste the link to an example project and exact instructions to reproduce the issue.)

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:5
  • Comments:5

github_iconTop GitHub Comments

2reactions
nj314commented, Sep 16, 2021

@jdgreenberger I had a similar symptom and fixed it by upgrading my typescript devDependency from ^3.9.0 to ^4.0.2. I was getting the expected eslint warnings / errors all along, but not the errors from tsc. This was on an existing project which had been migrated from CRA 3 to 4. After upgrading to TypeScript 4.x I started getting expected tsc compilation errors from react-scripts start.

0reactions
davetapleycommented, Jul 21, 2022

I got this too going from react-scripts 3.4.1 to 4.0.3 and https://github.com/facebook/create-react-app/issues/10852#issuecomment-921120083 fixed it.

I was about to open another issue to bump peerDependency, but I see that happened in #9964, albeit to:

https://github.com/facebook/create-react-app/blob/228528c3e768555db5c8e8b5cb04db9c5aae9fed/packages/react-scripts/package.json#L96-L98

I’m going to ask over there why ^3.2.1 || 🤔

Read more comments on GitHub >

github_iconTop Results From Across the Web

Not safe typescript compilation when webpack-dev-server ...
My little research showed that the problem is caused by '@types/node' package in my node_modules as it brings references to es2018. In ...
Read more >
TypeScript tool window | IntelliJ IDEA Documentation - JetBrains
The tool window lists all the compilation errors detected in the chosen scope. This list is not affected by changes you make to...
Read more >
DevServer - webpack
webpack-dev-server can be used to quickly develop an application. ... Shows a full-screen overlay in the browser when there are compiler errors or...
Read more >
TypeScript errors and how to fix them
error TS1192: Module ' json5 ' has no default export. Broken Code ❌. 1, import json5 from 'json5 ...
Read more >
Show Typescript errors in console during development
I don't think we can have the typescript errors while it's running (runtime error) because node server doesn't run typescript right?
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found