jaredpalmer / razzle

✨ Create server-rendered universal JavaScript applications with no configuration
https://razzlejs.org
MIT License
11.1k stars 868 forks source link

rs <enter> not working on Windows #1651

Open karanmartian opened 3 years ago

karanmartian commented 3 years ago

🐛 Bug report

Current Behavior

rs not working on Windows in any shell

Expected behavior

should restart the server. Its working fine on my Mac. Is this something that has to do with nodemon on Windows?

fivethreeo commented 3 years ago

Not sure, windows is always the odd one out. I don't use windows much.

fivethreeo commented 3 years ago

Was this issue with the config you posted? May be the double plugin?

karanmartian commented 3 years ago

@fivethreeo No this was with a clean install on Windows, no Hapi stuff. just default express. doesnt seem to take rs or any other input at all, it only takes ctrl c.

karanmartian commented 3 years ago

Ok so I figured that the with-typescript example is not accepting rs. Tried it on Ubuntu also. But the plain js from Razzle Get Started is working just fine. Request you to look into this. Also the messages that are displayed during compiling are different for the with-typescript example. Is it outdated?

fivethreeo commented 3 years ago

It runs tsc for typecheking aswell as razzle start. So diff output is expected. If you try without tsc?

karanmartian commented 3 years ago

Yea the watch mode was creating problems. I changed it to below:

"scripts": { "start:tsc": "tsc -b", "start": "razzle start", "build": "tsc -b && razzle build", "test": "razzle test --env=jsdom", "start:prod": "NODE_ENV=production node build/server.js" },

Then first I independently run start:tsc and then start. It seems to be working now and I can restart using rs. But is there a better solution?

fivethreeo commented 3 years ago

maybe using concurrently works?

karanmartian commented 3 years ago

Well with concurrently and watch mode on for tsc it keeps restarting the server endlessly with my Hapi SIGTERM configuration

fivethreeo commented 3 years ago

Input handling -i, --handle-input Whether input should be forwarded to the child processes. See examples for more information.[boolean] --default-input-target Identifier for child process to which input on stdin should be sent if not specified at start of input. Can be either the index or the name of the process.

fivethreeo commented 3 years ago

Add --noEmit to tsc incase it does not get it from tsconfig.

karanmartian commented 3 years ago

Got it with: "start": "concurrently --handle-input true --default-input-target 1 \"tsc -b -w --preserveWatchOutput\" \"razzle start\""

I actually shifted entirely to wsl 2 on windows and installed Vscode inside wsl 2, not windows and I am operating from there i.e. opening vscode using the new GUI App Support in wsl 2 in windows 11. So this is tested on linux which wasn't working before for Typescript. But should work fine on Windows as well. The only reason I am not using the Vscode on Windows is because it fails to auto refresh my changes made from wsl 2 inside explorer and source control views.

karanmartian commented 3 years ago

But the problem still arises in typescript,

With concurrently on, whenever I auto reload the server with my Hapi SIGTERM config for any file change it keeps restarting the server endlessly. Without concurrently this is not an issue. Is there any other program other than concurrently?