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
{{ message }}
Repository navigation
Add option to enable/disable followSymlinks of watchpack #6845
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#72
Now, 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.
Reacted by Suraj Kumar Shrestha, Rémi Chanaud, Bobby Ung, lucasABTasty, Labesse Kévin, thomaslebeauABTasty, abhafedh, Elias Cédric Laouiti, Matthieu Simon, bricelagroy and 25 more
Reacted by lucasABTasty, abhafedh, maxsim, Markus Padourek, achrefhafedh and Wissem
Reacted by lucasABTasty, abhafedh, Markus Padourek, achrefhafedh, John Steven Neira and Wissem
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).
Reacted by Brayden C, Will Robbins, Jay Faulkner, Lennart Hildebrandt, Harry Phillips, Markus Padourek, Nathanael Anderson, mrbone, Alex Ioannidis, Barış Uşaklı and 3 more
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.
Reacted by John K, Nathanael Anderson and Alex Ioannidis
@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?
That's on Watchpack (i.e. it now allows passing the flag). But what would an appropriate weback.config.js look like though to use the flag? I imagined something like this:
Not a particularly "nice" way, but since Webpack v5 is not yet released, a solution is to use the patch-package library to patch watchpack. Here's the patch diff, which also sets the depth parameter to 1 (needed for MacOS):
Are you sure about this? I am a little confused based on docs which actually point to watchOptions inside devServer conf. Also, when I put { followSymlinks: true } in webpack conf, nothing happens but adding it to devServer actually makes my app to recompile (though it does not hot reloads).
Activity
SEAPUNK commentedon May 7, 2018
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).
bcowell commentedon May 25, 2018
Would also like to see this included in webpack 4 as it is a bug.
Globegitter commentedon Aug 11, 2018
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.
immortal-tofu commentedon Oct 14, 2018
Well, since PR on watchpack didn't land yet, we can't do a lot... Comments and upvote PR linked in inital post :(
achrefhafedh commentedon Mar 6, 2019
AND FINALLY in Webpack 5
Neira1991 commentedon Mar 6, 2019
greatttt!!!!
wittibs commentedon Apr 25, 2019
@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!
neonick commentedon Sep 26, 2019
@immortal-tofu it looks like something you can close
immortal-tofu commentedon Sep 26, 2019
I close issue for now. I think it's ok now.
7 remaining items
immortal-tofu commentedon Feb 25, 2020
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" ;)
alexander-akait commentedon Feb 25, 2020
Solved for webpack@5, you can the option here https://github.com/webpack/watchpack#api
slint commentedon Feb 25, 2020
That's on Watchpack (i.e. it now allows passing the flag). But what would an appropriate
weback.config.jslook like though to use the flag? I imagined something like this:Or to allow full flexibility on what is passed to the
Watchpackconstructor:But none of these are reflected in the WebpackOptions schema currently.
alexander-akait commentedon Feb 25, 2020
Oh, yes, we need update schema, WIP
barisusakli commentedon Feb 25, 2020
Thanks, I just modified the source and changed
followSysmlinkstotruefor now.aviramaz commentedon May 17, 2020
It'll be solved as part of webpack v5?
Someone has any recommendation how to implement nicely for webpack v4?
slint commentedon May 17, 2020
Not a particularly "nice" way, but since Webpack v5 is not yet released, a solution is to use the
patch-packagelibrary to patch watchpack. Here's the patch diff, which also sets thedepthparameter to 1 (needed for MacOS):WeijieZhu0204 commentedon Oct 16, 2020
@slint It works !
alexander-akait commentedon Oct 16, 2020
Implemented
followSymlinkshttps://github.com/webpack/watchpackalexander-akait commentedon Oct 16, 2020
Need to send a PR to
watcherOptionshttps://github.com/webpack/webpack/blob/master/schemas/WebpackOptions.json#L3596nitinkatyal1314 commentedon Jul 23, 2021
Is this working with webpack 5? I have enabled
followSymlinksbut no luck. This is my devServer configurationdevServer: { followSymlinks: true }I see that changes to dependent library component (linked via npm link) triggers recompilation but the changes are not reflected in the browser.
alexander-akait commentedon Jul 23, 2021
devServerdoesn't have this optionnitinkatyal1314 commentedon Jul 27, 2021
Are you sure about this? I am a little confused based on docs which actually point to
watchOptionsinsidedevServerconf. Also, when I put{ followSymlinks: true }in webpack conf, nothing happens but adding it to devServer actually makes my app to recompile (though it does not hot reloads).