Conversation
This was referenced Dec 15, 2023
kathmbeck
reviewed
Jan 8, 2024
| cacheDirReq.resolve(cacheDirDep) | ||
| } catch { | ||
| // something is not resolable from the cache folder, so we should not enable this plugin | ||
| isEverythingResolvableFromCacheDir = false |
Contributor
There was a problem hiding this comment.
If this is false, could break out of the for loop.
Contributor
Author
There was a problem hiding this comment.
we would need 2 separate loops for checking if tested dependency is resolvable from .cache and from `gatsby package - which I think probably makes more sense than current single loop, so I will make the change to run those checks in separate loops and just break the loops on first unresolvable module
…r.ts Co-authored-by: Katherine Beck <49894658+kathmbeck@users.noreply.github.com>
…d gatsby package, break on first unresolvable module
kathmbeck
approved these changes
Jan 9, 2024
pieh
added a commit
that referenced
this pull request
Jan 10, 2024
* fix: use different method of figuring out wether to enable .cache resolver plugin * use multiple conditions when deciding wether to enable .cache folder resolver plugin * feat(gatsby-dev-cli): allow using pnpm for installing deps * test: add pnpm test * test: test api functions for pnp and pnpm * fix: api functions * Update packages/gatsby/src/utils/webpack/plugins/cache-folder-resolver.ts Co-authored-by: Katherine Beck <49894658+kathmbeck@users.noreply.github.com> * chore: separate test loops for trying to resolve from cache folder and gatsby package, break on first unresolvable module --------- Co-authored-by: Katherine Beck <49894658+kathmbeck@users.noreply.github.com> (cherry picked from commit d2ffc2a)
pieh
added a commit
that referenced
this pull request
Jan 10, 2024
* fix: use different method of figuring out wether to enable .cache resolver plugin * use multiple conditions when deciding wether to enable .cache folder resolver plugin * feat(gatsby-dev-cli): allow using pnpm for installing deps * test: add pnpm test * test: test api functions for pnp and pnpm * fix: api functions * Update packages/gatsby/src/utils/webpack/plugins/cache-folder-resolver.ts Co-authored-by: Katherine Beck <49894658+kathmbeck@users.noreply.github.com> * chore: separate test loops for trying to resolve from cache folder and gatsby package, break on first unresolvable module --------- Co-authored-by: Katherine Beck <49894658+kathmbeck@users.noreply.github.com> (cherry picked from commit d2ffc2a) Co-authored-by: Michal Piechowiak <misiek.piechowiak@gmail.com>
This was referenced Jan 23, 2024
This was referenced Jan 23, 2024
This was referenced May 9, 2024
This was referenced May 16, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Our "cache folder resolver" (webpack plugin that resolves gatsby dependencies for files copied from gatsby package to .cache directory) is currently only being enabled for Yarn PnP.
process.versions.pnpcheck is only ever used for yarn, pnpm doesn't use so this PR adds more conditions that allow enablement of the plugin:NODE_PATHenv var - this is used when running things throughpnpmCLI.cachedirectory - this path would be used when deps where installed with pnpm (tho it's possible other package managers can createnode_modulesstructures that would hit same case too) and then regulargatsbyCLI (and not viapnpmCLI) would be used to run gatsby - note that this path would NOT enable the plugin when usingpnpmcli - becauseNODE_PATHis set therequire.resolvetests would report that required deps are resolvable from.cache, but webpack resolver doesn't honor NODE_PATH so compilation would fail. (possible alternative would be to adjust webpack config to honor NODE_PATH but this is discouraged)This fixes errors like:
when using pnpm (and possible others)
-- update
API functions compilation is also currently broken when using
pnpmoryarn pnpso this is being fixed in this PR as wellCan be tested with
gatsby@5.13.0-alpha-fix-pnpm.21canaryTests
Added test for
pnpmsimilar as one we have for yarn PnP - tested in separate draft PRs:Related Issues
https://linear.app/netlify/issue/FRA-179/fix-using-gatsby-with-pnpm