馃悰 bug report
I start up Parcel's development server with a command like this:
parcel ./public/symlink-index.html
I have a symlink at ./public/symlink-index.html which points to an index.html file (in any location). The hot module replacement does not occur when changes are made to the symlinked index.html file. Hot module replacement only occurs when the symlink itself changes.
My .babelrc
{
"plugins": [
"transform-class-properties"
],
"presets": ["env", "stage-0", "react"]
}
When a change is made to the symlinked index.html file, hmr should occur.
When a change is made to the symlinked index.html file, no hmr occurs. Dev server must be restarted for changes to take effect.
We are using Bazel to build all of our projects. Bazel runs the parcel binary in a sandbox where it creates symlinks to all of the files in our app.
| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | 1.6.2
| Node | 9.7.1
| npm/Yarn | 5.6.0
| Operating System | High Sierra
This looks like an issue with Chokidar, the file-watcher that we use. Maybe consider opening this issue there?
It looks like Chokidar has a followSymlinks setting. If it is set to false, only the symlinks themselves will be watched for changes instead of following the link references and bubbling events through the link's path. Is it possible for this to be switched to true when using Parcel?
I looked into this more and Chokidar's followSymlinks option is set to true by default and Parcel isn't setting it to false anywhere. Also, I'm seeing that a symlinked directory works as expected, where the changes in the symlinked directory bubble events through the link's path. Individual symlinked files do not bubble events through the link's path, however. I'm looking into chokidar's code a bit more to see if this is their problem.
I dug into Chokidar's code and came up with a couple solutions for following symlinks. Unfortunately, even when symlinks are followed in Chokidar, Parcel adds the symlink itself rather than the symlink reference to the watchedAssets map:
https://github.com/parcel-bundler/parcel/blob/0140dcea58edd0df5959752e38faf41b96a1d509/src/Bundler.js#L320-L331
Do you have any thoughts on what should be done to address this issue?
fix released in v1.9.3.
Most helpful comment
I dug into Chokidar's code and came up with a couple solutions for following symlinks. Unfortunately, even when symlinks are followed in Chokidar, Parcel adds the symlink itself rather than the symlink reference to the watchedAssets map:
https://github.com/parcel-bundler/parcel/blob/0140dcea58edd0df5959752e38faf41b96a1d509/src/Bundler.js#L320-L331
Do you have any thoughts on what should be done to address this issue?