fix(gatsby-adapter-netlify): support monorepos #39005
Open
+85
−19
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.
Description
DSG/SSR handler was making some assumptions about how it's being mounted in serverless that were not correct when site deployed to Netlify is part of monorepo:
includedFiles
in particular was not working due to base directory assuming root of repo and hence those files were not being bundled (it did bundle some things due to regular import tracking, but not all required things when static analisys would not catch some files) - fixed with a3aa898.cache
directory for monorepo is not in<cwd>/.cache
and instead is in<cwd>/<package_path>/.cache
- instead of using<cwd>
to figure out directory it now goes other way around by resolving directory locations by resolving directories relative to main function entry point module - fixed with 6efd4bbThe changes can be tested using canary releases:
Tests
Added workflow that run adapters e2e tests with fixture using monorepo setup (first commit is just added monorepo test setup showing it failing lots of adapters e2e test and remaining commits fixed the problems making it pass).
Related Issues
Fixes https://linear.app/netlify/issue/FRA-552/ssr-error-enoent-no-such-file-or-directory-lstat-vartaskcachedata-on