Skip to content
This repository has been archived by the owner on Jul 27, 2020. It is now read-only.

Live reload doesn't work on Windows #121

Open
jferrettiboke opened this issue Apr 2, 2019 · 14 comments
Open

Live reload doesn't work on Windows #121

jferrettiboke opened this issue Apr 2, 2019 · 14 comments

Comments

@jferrettiboke
Copy link

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
@swolidity
Copy link

doesn't seem to be working on Mac for me either

@Dieff
Copy link

Dieff commented Apr 10, 2019

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.

@beeplin
Copy link

beeplin commented Apr 14, 2019

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.

@DevanB
Copy link
Contributor

DevanB commented Apr 15, 2019

@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.

@beeplin
Copy link

beeplin commented Apr 15, 2019

@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.

@Weakky
Copy link
Contributor

Weakky commented Apr 15, 2019

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.

@DevanB
Copy link
Contributor

DevanB commented Apr 15, 2019

It seems that it should be working that way (based on the code) @Weakky, but I can reproduce it consistently by doing the following:

  1. Create a new mutation or query that uses context to call a method (like I have an auth, email, prisma, and stripe context).
  2. Create that method on the context.
  3. Execute that query/mutation.

I consistently get back that X method is not a method on Y object (the context).

@williamluke4
Copy link

I change it from chokidar to node-watch and it fixed it. You see the changes here

@Weakky
Copy link
Contributor

Weakky commented Apr 26, 2019

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 🙏

@beeplin
Copy link

beeplin commented May 1, 2019

@Weakky I tested v0.0.20 on Windows, but unfortunately the hot reload is still not working:

  1. yarn create yoga (select 'from scratch' & 'mini')
  2. yarn add express (the generated code seems to lack express dependency)
  3. yarn dev
  4. make some change, and no live reload.

@jferrettiboke
Copy link
Author

@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.

@jferrettiboke
Copy link
Author

jferrettiboke commented May 13, 2019

@Weakky Any solution to this? It's almost impossible to work in this way.

@jferrettiboke
Copy link
Author

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.

@beeplin
Copy link

beeplin commented May 23, 2019

+1 @jferrettiboke just stopped using yoga2 in my project due to this issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants