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

(gatsby-plugin-mdx): GatsbyConfig typescript is not honoured when options are set #38603

Open
2 tasks done
jcxldn opened this issue Oct 2, 2023 · 0 comments
Open
2 tasks done
Labels
status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer type: bug An issue or pull request relating to a bug in Gatsby

Comments

@jcxldn
Copy link

jcxldn commented Oct 2, 2023

Preliminary Checks

Description

When using gatsby-plugin-mdx with gatsby-config.ts, if configuration options are set (such as mdxOptions), gatsby-config data is ignored. In my reproduction, the site title shows as null, and allFile has zero entries (should have one).

If gatsby-plugin-mdx is added without configuration options, everything works fine.

Reproduction Link

https://github.com/jcxldn/gatsby-mdx-reproduction

Steps to Reproduce

In minimal reproduction:

  1. Configure gatsby-plugin-mdx with options:
   {
      resolve: `gatsby-plugin-mdx`,
      options: {
        mdxOptions: {
          remarkPlugins: [
            remarkToc
          ]
        }
      }
    }
  1. Run gatsby develop --verbose
  2. Open GraphiQL and run the following query:
query MyQuery {
  allFile {
    totalCount
  }
  site(siteMetadata: {}) {
    siteMetadata {
      title
    }
  }
}
  1. Note that site title is null and totalCount is zero.
  2. Configure gatsby-plugin-mdx without options:
{ resolve: `gatsby-plugin-mdx` }
  1. Restart the server
  2. Note that site title is not null and totalCount is one.

Expected Result

Gatsby's config continues to be honoured and options set in it still apply (such as siteMetadata.title)

Actual Result

Config is not honored when options are set.

Environment

System:
    OS: Linux 6.4 Manjaro Linux
    CPU: (4) x64 Intel(R) Core(TM) m3-8100Y CPU @ 1.10GHz
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 20.6.1 - /usr/bin/node
    Yarn: 1.22.19 - /usr/bin/yarn
    npm: 10.1.0 - /usr/bin/npm
  Languages:
    Python: 3.11.5 - /usr/bin/python
  npmPackages:
    gatsby: ^5.12.4 => 5.12.4
    gatsby-plugin-mdx: ^5.12.0 => 5.12.0
    gatsby-source-filesystem: ^5.12.0 => 5.12.0

Config Flags

N/A.

@jcxldn jcxldn added the type: bug An issue or pull request relating to a bug in Gatsby label Oct 2, 2023
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Oct 2, 2023
@jcxldn jcxldn changed the title (gatsby-plugin-mdx): GatsbyConfig is not honoured when options are set (gatsby-plugin-mdx): GatsbyConfig typescript is not honoured when options are set Oct 8, 2023
jcxldn added a commit to genoswitch/wiki that referenced this issue Oct 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

No branches or pull requests

1 participant