-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
fix(gatsby-plugin-mdx): support yarn PnP #20638
Conversation
yarn 2 has now been released! Any chance we can take a look at this again 😉? @pieh? (Sorry if I pinged the wrong person) |
Just a note - I just published |
Ok, after few bumps, I did get it to build it when using Yarn2 (see appendix :P) and I think we should get this in. @johno do you want to check changes to -- Yarn 2 appendix
which I solved with
which I hackily solved by installing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✨ lgtm, thanks @kevin940726!
I would've leaned towards making the versions explicit in the package.json since both Gatsby and MDX core automatically bump dep versions on a quick cadence, but this will work!
Holy buckets, @kevin940726 — we just merged your PR to Gatsby! 💪💜 Gatsby is built by awesome people like you. Let us say “thanks” in two ways:
If there’s anything we can do to help, please don’t hesitate to reach out to us: tweet at @gatsbyjs and we’ll come a-runnin’. Thanks again! |
Published |
Description
See yarnpkg/berry#689 (comment)
In order to support yarn PnP, dependencies have to be explicit listed or required from their direct parents.
gatsby-plugin-mdx
has required some dependencies which are not listed inpackage.json
, but sub-dependencies of@mdx-js/mdx
.We have 2 options to fix this:
@mdx-js/mdx
updates. It would soon become troublesome and tedious.@mdx-js/mdx
package viaModule.createRequire
.This PR goes for the second approach. The
createRequireFromPath
util is already implemented in the core package fromgatsby/src/utils/create-require-from-path.js
. We can just use it here. (Now that it's used by a plugin, should we move it togatsby-core-utils
or something similar?)Documentation
https://next.yarnpkg.com/features/pnp/, and https://next.yarnpkg.com/advanced/migration
Related Issues
Related to yarnpkg/berry#689. c.c. @arcanis