Skip to content
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): allow not defining entry for subplugins #33900

Merged
merged 5 commits into from
Nov 9, 2021

Conversation

pieh
Copy link
Contributor

@pieh pieh commented Nov 8, 2021

Description

This fixes cases when gatsby-remark-* subplugins have main field pointing to something else than <root>/index module.

Related Issues

[ch40936]
closes #33677

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Nov 8, 2021
@pieh pieh added topic: remark/mdx Related to Markdown, remark & MDX ecosystem and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Nov 8, 2021
@@ -0,0 +1,4 @@
{
"name": "gatsby-plugin-child-with-main",
"main": "lib/index.js"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test case setup for issue described in #33677

try {
const resolvedPlugin = resolvePlugin(value, rootDir)
const modulePath = require.resolve(
`${resolvedPlugin.resolve}${entry ? `/${entry}` : ``}`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

main fix - allow falsy/undefined entry

@pieh pieh marked this pull request as ready for review November 8, 2021 19:56
Comment on lines +578 to +580
modulePath: expect.stringMatching(
/gatsby-plugin-child-with-main[/\\]lib[/\\]index\.js$/
),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

asserting that main field from package.json is used (lib/index.js)

Copy link
Contributor

@LekoArts LekoArts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome 🎉

@LekoArts LekoArts merged commit f87164f into master Nov 9, 2021
@LekoArts LekoArts deleted the fix/subplugins-main branch November 9, 2021 08:58
LekoArts pushed a commit that referenced this pull request Nov 9, 2021
@karlhorky
Copy link
Contributor

Nice, this is great thanks! Is this scheduled for release in 4.1.2?

LekoArts pushed a commit that referenced this pull request Nov 9, 2021
Co-authored-by: Michal Piechowiak <misiek.piechowiak@gmail.com>
@LekoArts
Copy link
Contributor

LekoArts commented Nov 9, 2021

Yes! If a PR is in the "Release Hotfixes" project it'll be released as a patch for that version soonish.

@LekoArts
Copy link
Contributor

LekoArts commented Nov 9, 2021

Successfully published:
 - create-gatsby@2.1.1
 - gatsby-cli@4.1.1
 - gatsby-plugin-cxs@4.1.1
 - gatsby-plugin-feed@4.1.1
 - gatsby-plugin-flow@3.1.1
 - gatsby-plugin-google-tagmanager@4.1.1
 - gatsby-plugin-manifest@4.1.1
 - gatsby-plugin-mdx@3.1.1
 - gatsby-plugin-offline@5.1.1
 - gatsby-plugin-page-creator@4.1.1
 - gatsby-plugin-sass@5.1.1
 - gatsby-plugin-sharp@4.1.1
 - gatsby-plugin-sitemap@5.1.1
 - gatsby-plugin-twitter@4.1.1
 - gatsby-plugin-utils@2.1.1
 - gatsby-remark-autolink-headers@5.1.1
 - gatsby-remark-images@6.1.1
 - gatsby-source-contentful@6.1.1
 - gatsby-source-shopify@6.1.1
 - gatsby-transformer-remark@5.1.1
 - gatsby-transformer-sqip@4.1.1
 - gatsby@4.1.2

@karlhorky
Copy link
Contributor

gatsby@4.1.2 works well, thanks!

@jf-home
Copy link

jf-home commented Nov 9, 2021

I still have an issue as described here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: remark/mdx Related to Markdown, remark & MDX ecosystem
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Subplugins loading doesn't respect main field in package.json
4 participants