Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Hot reloading broken when saving a file from a workspace that has peerDependencies listed #1209

Closed
1 task done
dalinarkholin opened this issue Apr 16, 2020 · 5 comments · Fixed by #1671
Closed
1 task done
Labels
bug Something isn't working upholded Real issues without formal reproduction

Comments

@dalinarkholin
Copy link

  • I'd be willing to implement a fix

Describe the bug

When adding a peerDependency to a workspace that is shared between multiple front end applications(react), our dev cycle is somewhat disrupted. Hot reloading no longer picks up changes to file saves within the shared workspace.

To Reproduce

Reproduction found here

  • clone
  • cd packages/project
  • yarn start
  • save file within packages/shared
  • note recompile does not occur

Environment if relevant (please complete the following information):

  • OS: macOS Catalina
  • Node version: 12.16.1
  • Yarn version: 2.0.0-rc.31
@dalinarkholin
Copy link
Author

dalinarkholin commented Apr 29, 2020

The workaround for this issue is to disable polling for the time being until fs.watchFile can work with a Virtual FS.

@missing1984
Copy link
Contributor

I think I ran into the same issue. How do you disable polling in this case?

@ChiefORZ
Copy link

i stumbled upon the same issue, and the tip from @dalinarkholin helped as a workaround!
when using chokidar - you can force to use fs.watch by setting the environment variable CHOKIDAR_USEPOLLING=0. this works for create-react-app for example: CHOKIDAR_USEPOLLING=0 yarn dev

thanks for the workaround!

@yarnbot
Copy link
Collaborator

yarnbot commented Jun 11, 2020

Hi! 👋

This issue looks stale, and doesn't feature the reproducible label - which implies that you didn't provide a working reproduction using Sherlock. As a result, it'll be closed in a few days unless a maintainer explicitly vouches for it or you edit your first post to include a formal reproduction (you can use the playground for that).

Note that we require Sherlock reproductions for long-lived issues (rather than standalone git repositories or similar) because we're a small team. Sherlock gives us the ability to check which bugs are still affecting the master branch at any given point, and decreases the amount of code we need to run on our own machines (thus leading to faster bug resolutions). It helps us help you! 😃

If you absolutely cannot reproduce a bug on Sherlock (for example because it's a Windows-only issue), a maintainer will have to manually add the upholded label. Thanks for helping us triaging our repository! 🌟

@yarnbot yarnbot added the stale Issues that didn't get attention label Jun 11, 2020
@merceyz merceyz added upholded Real issues without formal reproduction and removed stale Issues that didn't get attention labels Jun 11, 2020
@missing1984
Copy link
Contributor

spent some time on this, it turns out to be chokidar and our virtual fs patch on fsevents causes those issues.

It's easy to reproduce:

const chokidar = require('chokidar');

const files = [
    '/foo',
    '/foo/.yarn/$$virtual/foo-virtual-fbd1a43281/3/lib/index.js',
];

chokidar.watch(files).on('change', (event, path) => {
    console.log(event, path);
});

in this case, chokidar only uses fsevents to watches /foo as it's the root. Updating index.js would not trigger the callback which seems to be wrong.

and btw, CHOKIDAR_USEPOLLING=0 no longer works in latest webpack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working upholded Real issues without formal reproduction
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants