nodegui / react-nodegui

Build performant, native and cross-platform desktop applications with native React + powerful CSS like styling.🚀
https://react.nodegui.org
MIT License
6.18k stars 171 forks source link

hot reloading not working? #354

Open ghost opened 3 years ago

ghost commented 3 years ago

Describe the bug well.. hot reload doesnt work

To Reproduce Steps to reproduce the behavior:

  1. get latest react-nodegui-starter
  2. run yarn (or npm) run dev
  3. also run yarn (or npm) run start
  4. try to change code
  5. wont change

Expected behavior it should change the behavior/look of the window

Screenshots well i have no idea how to describe it in images

Desktop (please complete the following information):

Additional context nope

ghost commented 2 years ago

Doesn't work for me too on Xubuntu Focal.

ZaLiTHkA commented 2 years ago

same here, affects ~both~ Windows 10 ~and Pop!_OS 21.10~ for me, with Node 14 and 16..

feedback in the terminal shows the project rebuilding, but the rendered window simply doesn't "refresh".

edit: FWIW, I did try with the root App component as a React Class as per #349, but that did not seem to make any difference.

edit 2: got it working on Linux, somehow.. see additional comment below.

Hydrair commented 2 years ago

edit: FWIW, I did try with the root App component as a React Class as per #349, but that did not seem to make any difference.

Can confirm, no hot reloading on Pop OS 21.10, followed the Getting started section.

ZaLiTHkA commented 2 years ago

so, after messing around trying to get Volta working, I just got the current nodegui/react-nodegui-starter project up and running (~with NVM, not Volta..~ scratch that, it runs with Node from either one..) and hot reload is working.. 🤔

my current project was created from this commit, and my environment has the following:

 ~/workspace/sandbox/react-nodegui-tester  master !3 ?1                                                                                                                                                                                 
❯ node -v
v16.13.2

 ~/workspace/sandbox/react-nodegui-tester  master !3 ?1                                                                                                                                                                                 
❯ npm -v
8.1.2

 ~/workspace/sandbox/react-nodegui-tester  master !3 ?1                                                                                                                                                                                 
❯ npm ls -g
/home/dre/.nvm/versions/node/v16.13.2/lib
├── @angular/cli@13.1.2
├── @aws-amplify/cli@7.6.4
├── @nrwl/cli@13.3.9
├── corepack@0.10.0
├── firebase-tools@10.1.0
└── npm@8.1.2

hmmm... I'll try again on Windows soon.

ghost commented 2 years ago

well I am using yarn, that might be the issue?

ZaLiTHkA commented 2 years ago

hmmm... I'll try again on Windows soon.

trying this again on my Windows 10 PC this morning, I now have hot reload working.. same Node and NPM versions, cloned react-nodegui-starter from the same commit (current HEAD, fwiw), launched npm run dev and npm start, and changes to src/app.tsx are reflected in the running app almost instantly.

so, VSCode "Package Json Upgrade" shows a bunch of newer versions available for virtually all of the starter project's deps, but package-lock.json does cause the listed versions to be installed (confirmed with npm ls --depth=0, all versions match package.json exactly).

at this point, since the starter references @types/node@^14.11.1, I decided to flip over to Node 14 (Volta picked 14.18.3). running npm install ran just fine, the cmake-js compile post-install command completed with no errors (Minimal Qt 5.14.1), and again, hot reload is still working.


I'm very confused now, why was it broken and now it's not? what changed? react-nodegui-starter hasn't in ages, and specifically it's package.json hasn't changed in almost a year..

ZaLiTHkA commented 2 years ago

ah, I think I've got something.. I was just running through this with the newer versions of @nodegui/react-nodegui, while leaving all other deps alone.

both 0.11.0 and 0.12.0 are good, with hot reload working as expected. but then I run into issues trying to install 0.13.0. it seems the upgrade from 0.12.0 to 0.13.0 changed the following relevant points:


alrighty.. I'm going to stop with my testing here, because this is starting to look like there are dependency update issues. also, because I'm actually at work and I need to focus on other things now. 😁

I'll look at re-creating the starter project from scratch with the latest (compatible?) dependency versions when I get home this evening. so unless someone else beats me to it, I'll post my findings after that.

Sledmine commented 2 years ago

Same here, does not work in Pop OS 20.4 using Yarn, fresh install, no hot reloading at saving files, I want to take a look too and contribute with a possible fix, but until that, hopefully someone can take a look at this faster than me.

pseudoramble commented 2 years ago

I also cloned the starter project, and then used yarn (1.x series) to set things up and noticed hot reloading wasn't working. So I redid the setup using npm (8.3.1) and it seems to work fine with that configuration. I'm not really sure why that would matter, but it does seem to. I'm guessing it's because it's not respecting the package lock file and a newer dependency has an issue of some sort.