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 peer dep on mdx-js/mdx must be increased to ^1.5.9 #25691

Closed
stefcameron opened this issue Jul 10, 2020 · 2 comments · Fixed by #25798
Closed

gatsby-plugin-mdx peer dep on mdx-js/mdx must be increased to ^1.5.9 #25691

stefcameron opened this issue Jul 10, 2020 · 2 comments · Fixed by #25798
Assignees
Labels
type: bug An issue or pull request relating to a bug in Gatsby

Comments

@stefcameron
Copy link

Description

So this new call here to mdx.createCompiler(compilerOptions) from #25437, which I'm now picking up when upgrading from gatsby-plugin-mdx 1.2.22 -> 1.2.25 (3 patches), is suddenly causing my build to fail because mdx.createCompiler is not a function:

> docz-app@ build /dds/docs/.docz
> gatsby build "--prefix-paths"

warn Configuring yargs through package.json is deprecated and will be removed in the next major release, please use the JS API instead.
warn Configuring yargs through package.json is deprecated and will be removed in the next major release, please use the JS API instead.
success open and validate gatsby-configs - 1.366s
success load plugins - 1.152s
success onPreInit - 0.020s
success delete html and css files from previous builds - 0.012s
success initialize cache - 0.009s
success copy gatsby files - 0.135s
success onPreBootstrap - 0.408s
success createSchemaCustomization - 0.005s

 ERROR #11321  PLUGIN

"gatsby-plugin-mdx" threw an error while running the onCreateNode lifecycle:

mdx.createCompiler is not a function



  TypeError: mdx.createCompiler is not a function

  - gen-mdx.js:236 findImports
    [dds]/[gatsby-plugin-mdx]/utils/gen-mdx.js:236:24

  - on-create-node.js:59 Object.module.exports [as onCreateNode]
    [dds]/[gatsby-plugin-mdx]/gatsby/on-create-node.js:59:46


not finished source and transform nodes - 2.187s

Steps to reproduce

Use the plugin with peer dependency @mdx-js/mdx at 1.5.8 or less.

https://github.com/stefcameron/gatsby-plugin-mdx-peer-repro

$ yarn build # will fail
$ yarn add @mds-js/mdx@1.5.9
$ yarn build # will succeed

Expected result

I did some digging and found this comes from @mdx-js/mdx in this PR mdx-js/mdx#1018 from April 21, 2020, which was picked-up in @mds-jx/mdx@1.5.9. You can see that by noting that:

This means that, at the least, the peer dependency of gatsby-plugin-mdx on @mdx-js/mdx@^1.0.0 should have been bumped to ^1.5.9 as of this change.

Actual result

Production build (only) fails because @mdx-js/mdx peer was < 1.5.9.

Environment

  System:
    OS: macOS 10.15.5
    CPU: (8) x64 Intel(R) Core(TM) i7-8559U CPU @ 2.70GHz
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 12.18.1 - /var/folders/28/wcd3h4fn6y33tl_65x3lpp0w0000gq/T/yarn--1594418651189-0.1116926118957724/node
    Yarn: 1.22.4 - /var/folders/28/wcd3h4fn6y33tl_65x3lpp0w0000gq/T/yarn--1594418651189-0.1116926118957724/yarn
    npm: 6.14.6 - ~/.nvm/versions/node/v12.18.1/bin/npm
  Languages:
    Python: 3.7.6 - /usr/local/opt/python/libexec/bin/python
  Browsers:
    Chrome: 83.0.4103.116
    Firefox: 68.0.2
    Safari: 13.1.1
@stefcameron stefcameron added the type: bug An issue or pull request relating to a bug in Gatsby label Jul 10, 2020
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Jul 10, 2020
@TylerBarnes TylerBarnes added topic: MDX and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Jul 10, 2020
@johno
Copy link
Contributor

johno commented Jul 16, 2020

Thank you for the thorough issue! I'll be opening up a PR shortly to address this.

johno added a commit that referenced this issue Jul 16, 2020
We recently began using a new API in MDX with #25437 which
doesn't exist for all versions below 1.5.9. This updates the
peer dep for MDX to ensure that the new minimum version is
specified.

Fixes #25691
@stefcameron
Copy link
Author

Thank you for the thorough issue! I'll be opening up a PR shortly to address this.

My pleasure, and thank you for the PR!

laurieontech pushed a commit that referenced this issue Jul 16, 2020
…25798)

We recently began using a new API in MDX with #25437 which
doesn't exist for all versions below 1.5.9. This updates the
peer dep for MDX to ensure that the new minimum version is
specified.

Fixes #25691
CanRau added a commit to GaiAma/gaiama.org that referenced this issue Sep 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants