Hot reloading breaks when encountering Typescript error
See original GitHub issueDescribe the bug
I am having exactly same issue as metioned in https://github.com/facebook/create-react-app/issues/8055
Since that issue is now closed, I will just re-describe the issue again here.
Hot reloading seems to stop working when a Typescript compilation error is encountered. Any subsequent code changes would not trigger hot reloading after that, even if I fix the lines that would cause compile errror.
I need to actually close and restart the dev server in order to see my changes reflected.
Which terms did you search for in User Guide?
Typescript, Hot reloading
Environment
System:
OS: Linux 4.19 Ubuntu 18.04.2 LTS (Bionic Beaver)
CPU: (12) x64 AMD Ryzen 5 3600 6-Core Processor
Binaries:
Node: 13.7.0 - /usr/bin/node
Yarn: 1.21.1 - /mnt/c/Program Files (x86)/Yarn/bin/yarn
npm: 6.14.2 - /usr/bin/npm
Browsers:
Chrome: Not Found
Firefox: Not Found
npmPackages:
react: ^16.13.0 => 16.13.0
react-dom: ^16.13.0 => 16.13.0
react-scripts: 3.4.0 => 3.4.0
npmGlobalPackages:
create-react-app: 3.4.0
Steps to reproduce
create-react-app react-app --template typescript
cd react-app
yarn start
- Write invalid typescript code in
src/App.tsx
and save it to trigger compilation error - See TS compiler error message in terminal
- Fix the code in
src/App.tsx
and save it - Note that hot reloading is now NOT triggered
- Killing dev server and running
yarn start
again to see changes get reflected
Expected behavior
Re-compile and hot reload on every save, just like when using create-react-app
without the --template typescript
flag
Issue Analytics
- State:
- Created 4 years ago
- Reactions:74
- Comments:50
Top Results From Across the Web
Hot reloading breaks when encountering Typescript error
The dev server fails to compile once encoutering the ts error. Even if I fix the error and save the file, the hot...
Read more >I'm Having Problems With React Typescript Compilation - ADocLib
RunJS is a modern JavaScript and TypeScript playground displaying instant results Hot reloading breaks when encountering Typescript error Issue #8667.
Read more >anyone else have problems with React's --template typescript ...
Hot -reloading broken, missing @types/react. ... Doesn't detect random gibberish that should cause errors, but still detects other changes so ...
Read more >Troubleshooting XAML Hot Reload - Visual Studio (Windows)
Error indicates that the change you're attempting isn't supported by XAML Hot Reload. Stop the debugging session, make the change, and then ...
Read more >typescript language server exited with error. error message is
Describe the bug ... Since that issue is now closed, I will just re-describe the issue again here. Hot reloading seems to stop...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Guys, there seems to be a silly (but ugly) workaround. Anyway better than restarting the dev server I think. Please try the following:
I have a similar problem, maybe not be the exact same problem, but I wonder if it’s related. My problem is that if I have a TypeScript error in a file which isn’t actually imported (yet or any more) by any other module descending from the entry point, saving it doesn’t trigger recompiling. For the recompiling to start, I have to go to a file that is actually imported somewhere in the import tree starting from index.tsx and just save it (without changes). A bit annoying, while not the biggest of problems.