You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because some of the workspaces have peer dependencies, files from that workspace will apear as a PnP virtual. That is, when a change is made to button it will come through as something like
// config file dependencies and env file might be outside of root
[
root,
...config.configFileDependencies,
...getEnvFilesForMode(config.mode,config.envDir),
],
resolvedWatchOptions,
)asFSWatcher)
ie, with the project root; in this case c:/dev. The __virtual__ dir is not picked up by this, and file change events come in under the physical file location (c:/dev/packages/react/button.tsx) which isn't watched and thus the changes are ignored.
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
Describe the bug
I have a project set up as a monorepo using yarn workspaces and pnp .
Because some of the workspaces have peer dependencies, files from that workspace will apear as a PnP virtual. That is, when a change is made to button it will come through as something like
However, the chokidar watcher is initialised like this:
vite/packages/vite/src/node/server/index.ts
Lines 438 to 446 in 775bb50
ie, with the project root; in this case
c:/dev
. The__virtual__
dir is not picked up by this, and file change events come in under the physical file location (c:/dev/packages/react/button.tsx
) which isn't watched and thus the changes are ignored.The problem appears to be here:
vite/packages/vite/src/node/utils.ts
Lines 752 to 753 in 775bb50
in
ensureWatchedFile
, which is supposed to add any used files to the watcher that aren't already there.Because the
__virtual__
dir is located in the project root, this bit of code assumes that it is already watched and ignores.Reproduction
https://github.com/mrginglymus/vite-pnp
Steps to reproduce
Check out the linked reproduction and install with yarn.
Run
yarn dev
and attempt to make changes tobutton.jsx
- observe that they do not trigger hmr.Edite
vite.config.js
to have aroot
ofdemo
and runyarn dev
again.Make changes to
button.jsx
- observe that they do now trigger hmr.System Info
Used Package Manager
yarn
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: