feat(gatsby): Switch over to watchpack #15854
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Elevator Pitch
Everyone who uses Gatsby uses
gatsby develop
and this change will make it faster and perform with fewer system resources on lower end machines by making file watching more efficient.Why?
We've seen several issues with
chokidar
where changes aren't triggered in CI, on Docker, on Vagrant etc and it can be very expensive to have multiple file watchers acrosswebpack
and Gatsby's own query watchers. This PR replaceschokidar
inquery-watcher.js
withwatchpack
(what webpack uses)Advantages include:
skip until this change because it refused to trigger change when writing to disk on a CircleCI job worker)
aggregated
options which lets us batch changes together meaning we can wait till successive changes till say 1 second rather invoking query compilation on every single individual change (this is what happens now)Goodbye, Chokidar
https://www.youtube.com/watch?v=DQAKY1ntM9o
Know it sounds funny
But I just can't stand the pain
Girl I'm leaving you tomorrow
Seems to me girl
You know I've done all I can
You see I begged, stole
And I borrowed
Ooh, that's why I'm easy
I'm easy like Sunday morning
That's why I'm easy
I'm easy like Sunday morning
Why in the world
Would anybody put chains on me?
I've paid my dues to make it
Everybody wants me to be
What they want me to be
I'm not happy when I try to fake it!
No!
Ooh, that's why I'm easy
I'm easy like Sunday morning
That's why I'm easy
I'm easy like Sunday morning
I wanna be high, so high
I wanna be free to know
The things I do are right
I wanna be free
Just me, babe!
That's why I'm easy
I'm easy like Sunday morning
That's why I'm easy
I'm easy like Sunday morning
Because I'm easy
Easy like Sunday morning
Because I'm easy
Easy like Sunday morning
Disclaimer
chokidar
is awesome andwatchpack
is a wrapper on top of it (at least at v1) so this doesn't imply by any means thatchokidar
isn't valuable, just thatwatchpack
seems like a more appropriate level of abstractionRelated
#6207