-
-
Notifications
You must be signed in to change notification settings - Fork 243
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
webpack side file watching #516
Conversation
In order to watch for new files and type-only files in the webpack's compilation, we can use `fileDependencies` and 'contextDependencies` sets. Unfortunately, watchpack will ignore new files by default. To overcome this limitation, we are overwriting built-in NodeWatchFileSystem with our custom implementation for directory watching.
Now there should be no difference between all and webpack scope BREAKING CHANGE: 🧨 Remove issue.scope option and use new watch architecture
ff4e149
to
6fd0d27
Compare
Looking amazing - a lot of failing tests though! |
6fd0d27
to
a10d1e3
Compare
Yes, it's nice because it proves that they really work :D There are some quirks regarding case-sensitiveness in different operating systems and how it's handled by libraries (typescript, fsevents, webpack, chokidar...). I'm trying to make it work :D |
a10d1e3
to
6cf22d7
Compare
6cf22d7
to
839026a
Compare
Tests are passing, I'm going to ship this experimental version :) |
🎉 This PR is included in version 6.0.0-alpha.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 6.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This PR moves all watching logic to the webpack side.
Motivation
This change allows us to watch for files changes in the same way as
tsc
does. It means that we can watch for "type-only" files because they become a part of the webpack's compilation (they are added to thecompilation.fileDependencies
).Implementation
Each reporter (typescript, eslint) is asked to provide a list of dependencies (files and dirs) which are then watched by webpack. Unfortunately, webpack's directory watching is not very flexible and we are not able to handle the "add new file" case. The solution is hacky and experimental (see InclusiveNodeWatchFileSystem) but it seems to work. I'm not happy with the fact that we re-load SolutionBuilder when we add or remove files. It seems highly inefficient but it works for now and I don't have a better idea.
Notes
I suspect that there will be some bugs/issues with this code as it hooks into some webpack internals. That's why I would like to publish it as alpha and test it in real life :)