-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
Add option to enable/disable followSymlinks of watchpack #6845
Comments
Why is this planned for webpack 5? Can't this land in webpack 4 as a feature request? I don't see how any of this would be a breaking change, this is primarily a non-breaking feature (or even a bugfix, since watching is obviously broken). |
Would also like to see this included in webpack 4 as it is a bug. |
Agree with the sentiment here, this is either a backwards compatible feature or a bug-fix so there should be no issue shipping it with with v4 and it seems quite a few people would benefit from it. |
Well, since PR on watchpack didn't land yet, we can't do a lot... Comments and upvote PR linked in inital post :( |
AND FINALLY in Webpack 5 |
greatttt!!!! |
@birdy @evilebottnawi - I saw this issue was marked as "D0 first commit" so I decided to pursue it :P In researching this issue, I think I understand the problem, but I am unable to reproduce the issue with webpack not picking up on changes in symlinked module. I created a sample repo to demonstrate how I am unable to reproduce this issue. Is this still an issue? Or has it been fixed? Thanks! |
@immortal-tofu it looks like something you can close |
I close issue for now. I think it's ok now. |
For information, watchpack finally add the option for followSymlinks. |
@wittibs Basically the issue is simple:
First solution: Second solution: This is my summary. Maybe the problem described doesn't exist anymore, I switched to babel 7 everywhere so I encounter far less issue. I keep close this issue, but tell me if it occurs again. Since watchpack added the option, if the problem still occurs, it can be solved by webpack team. |
I believe this issue still exists regarding files in symlinked folders not being watched when symlink is set to false. It looks like followSymlinks was never exposed, so this should be re-opened, correct? |
@EmpireJones fixed in webpack@5 |
@immortal-tofu, @evilebottnawi, @achrefhafedh in what PR/commit was this solved in IMHO issue should be re-opened until there is a way to also be able to pass options to Watchpack. |
Is this really fixed in v5? |
I don't know if it's fixed in v5. I opened this issue 2 years ago and so far, I didn't see an answer "Problem solved see commit 35D43F53" ;) |
Solved for webpack@5, you can the option here https://github.com/webpack/watchpack#api |
That's on Watchpack (i.e. it now allows passing the flag). But what would an appropriate module.exports = {
//...
watchOptions: {
followSymlinks: true
}
}; Or to allow full flexibility on what is passed to the module.exports = {
watchOptions: {
//...
watchpackConfig: { // this probably overrides Webpack's default config options
followSymlinks: true,
// ...
}
}
}; But none of these are reflected in the WebpackOptions schema currently. |
Oh, yes, we need update schema, WIP |
Thanks, I just modified the source and changed |
It'll be solved as part of webpack v5? |
Not a particularly "nice" way, but since Webpack v5 is not yet released, a solution is to use the
diff --git a/node_modules/watchpack/lib/DirectoryWatcher.js b/node_modules/watchpack/lib/DirectoryWatcher.js
index 940f616..210a1b7 100644
--- a/node_modules/watchpack/lib/DirectoryWatcher.js
+++ b/node_modules/watchpack/lib/DirectoryWatcher.js
@@ -53,8 +53,8 @@ function DirectoryWatcher(directoryPath, options) {
this.watcher = chokidar.watch(directoryPath, {
ignoreInitial: true,
persistent: true,
- followSymlinks: false,
- depth: 0,
+ followSymlinks: true,
+ depth: 1,
atomic: false,
alwaysStat: true,
ignorePermissionErrors: true, |
@slint It works ! |
Implemented |
Need to send a PR to |
Is this working with webpack 5? I have enabled
I see that changes to dependent library component (linked via npm link) triggers recompilation but the changes are not reflected in the browser. |
|
Are you sure about this? I am a little confused based on docs which actually point to |
Context:
You have project A in babel 6 and project B transpiled via babel 7. You run a webpack watch in package B directory to create bundle while you code.
If you
npm link
package B in package A, and run webpack in package A, it will throw an error because he doesn't find dependencies.A webpack's issue is open here: #1866
Solution
In webpack, it's possible to disable symlinks via
symlinks: false
. It works and babel (of package A) won't try to transpile package B. Sadly, if you do this, webpack won't react to change.It's possible to change this behavior with
followSymlinks
in watchpack/chokidar. A PR has been added there to add this option: webpack/watchpack#72Now, we need the last part: add an exposed option in webpack configuration to enable/disable this watchpack new option. As stated by @TheLarkInn, it could be planned for webpack v5.
The text was updated successfully, but these errors were encountered: