Skip to content

fix(gatsby): framework bundling compatibility with multiple package managers #32701

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Js-Brecht
Copy link
Contributor

Description

This changes the test performed for the framework cache group, so that it is compatible with more than just yarn 1 or npm.

Primary issue with the regular expression is that pnpm in particular always has two levels of node_modules. There is not, however, a good regular expression that will detect if the module being tested is the one that belongs to the default site when using pnpm. This is an issue because the framework packages are now always being bundled in commons.js, which results in some runtime errors because framework.js doesn't exist.

To fix this, I compile a list of framework locations that only belong to the default site, and then change the cache group test to a function that is able to compare against that list of valid framework directories.

I was initially going to handle this fix in gatsby-plugin-pnpm alone, but it makes as much sense to do it here, so that there is only one source of truth for the framework bundle names.

This shouldn't cause any issues with npm, yarn 1, or yarn 2.

Related Issues

Js-Brecht/gatsby-plugin-pnpm#8
Js-Brecht/gatsby-plugin-pnpm#10

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Aug 4, 2021
@Js-Brecht
Copy link
Contributor Author

Not sure what's going on with the tests; some problem with cache-dir/production-app.js... I can reproduce the problem locally, but reverting these changes doesn't seem to make a difference, so I don't really think it's related.

@TylerBarnes TylerBarnes added topic: webpack/babel Webpack or babel and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Aug 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: webpack/babel Webpack or babel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants