yoga2
yoga2 copied to clipboard
Live reload doesn't work on Windows
Describe the bug Live reload doesn't work on Windows after running the server. I need to restart the server manually each time I do changes.
Versions (please complete the following information):
- OS: Windows 10 Pro
- Node:
v10.15.3
-
yoga
dependency:v0.0.18
doesn't seem to be working on Mac for me either
I have also noticed this on Linux (Arch, 5.06). Using yoga v0.0.18
, node v11.6.0
.
yoga dev
does a great job of updating the generated types and schema, but doesn't actually restart the server process. For example, any changes I make to resolver code do nothing until kill the process and run yoga dev
again.
Maybe this is because yoga2
now uses ts-node
instead of ts-node-dev
.
Currently yoga dev
only auto restart after each yarn prisma deploy
, but I guess most developers expect it to auto restart on all file changes within src
.
[EDIT] most examples in https://github.com/prisma/prisma-examples are using ts-node-dev
and they work fine.
@beeplin this is more than likely the issue. I've tried replacing ts-node
with ts-node-dev
, but I've been unable to figure out how to start ts-node-dev
programmatically.
@DevanB Yes, yoga dev
uses ts-node
's register
to compile .ts files programmatically, which is probably not available in ts-node-dev
.
A more feasible way, I guess, might be use nodemon
or node-dev
to wrap yoga dev
.
Hey there,
I'll investigate that issue soon. The dev
command is working fine for me on OSX.
Although we're not using ts-node-dev
, we're replicating ts-node-dev behavior to watch/recompile files on-the-fly.
All .ts files are supposed to be watched in your folder, not only the one related to prisma deploy, this is a bug.
I suspect the issue is coming from chokidar
, the file watcher we use.
It seems that it should be working that way (based on the code) @Weakky, but I can reproduce it consistently by doing the following:
- Create a new mutation or query that uses context to call a method (like I have an auth, email, prisma, and stripe context).
- Create that method on the context.
- Execute that query/mutation.
I consistently get back that X method is not a method on Y object (the context).
I change it from chokidar
to node-watch
and it fixed it. You see the changes here
Hey there,
The dev command should now work properly, checkout the release note of [email protected]
here
https://github.com/prisma/yoga2/releases/tag/v0.0.19
The problem wasn't about file watching, but about require.cache
not being properly invalidated between two reloads.
If some of you still have the problem, then we'll have to investigate whether chokidar
is also a source of issues. VSCode uses it thought, so we should be able to use it reliably.
@jferrettiboke I wasn't able to test on Windows, any feedback would be much appreciated 🙏
@Weakky I tested v0.0.20 on Windows, but unfortunately the hot reload is still not working:
- yarn create yoga (select 'from scratch' & 'mini')
- yarn add express (the generated code seems to lack
express
dependency) - yarn dev
- make some change, and no live reload.
@jferrettiboke I wasn't able to test on Windows, any feedback would be much appreciated 🙏
@Weakky It doesn't work on Windows yet. Still the same issue.
@Weakky Any solution to this? It's almost impossible to work in this way.
Does anyone still have the same issue than me? I would appreciate if someone, hopefully @Weakky, could have a look into this and give us a fix. I am using yoga
in a project, and it's hard to make changes because I need manually to restart the server each time. Thanks in advance, guys.
+1 @jferrettiboke just stopped using yoga2 in my project due to this issue.