Set `global.__GATSBY.root` in SSR
ascorbic opened this issue · comments
In a recent update, Gatsby uses the global.__GATSBY.root
variable for the cache directory, rather than process.cwd()
. This means we no longer need to patch the bundle for these versions. Instead we should set the value for global.__GATSBY.root
to the cache dir in os.tmpdir()
. We already create this, because it's where we move files that need to be writeable.
The fix is relatively simple - just adding the variable (the old method needs to be left in for old versions of Gatsby) but it needs good testing to see if setting the root has unexpected side effects.
Closing because the amend is not trivial and difficult to test, plus we already have a working implementation so there isn't a lot of value in it.