mdx-js / mdx

Markdown for the component era
https://mdxjs.com
MIT License
17.71k stars 1.14k forks source link

Compiler API: createCompiler is not a function #1025

Closed nwalters512 closed 4 years ago

nwalters512 commented 4 years ago

Subject of the issue

Per https://mdxjs.com/advanced/api#compiler, I should be able to access the compiler like this:

const { createCompiler } = require('@mdx-js/mdx')

However, when I try to do that, I get the following error:

TypeError: createCompiler is not a function

When I look at node_modules/@mdx-js/mdx/index.js, I see that createMdxAstCompiler is the only compiler creation function exported.

Your environment

Steps to reproduce

Run the example on https://mdxjs.com/advanced/api#compiler with the latest version of all dependencies.

Expected behaviour

{ title: "Hello, MDX" } should be logged to the console.

Actual behaviour

The program crashes with the following error:

TypeError: createCompiler is not a function
johno commented 4 years ago

Thanks for opening an issue @nwalters512! Can you bump MDX to 1.5.9 (just cut a new release) and see if that fixes your issue?

nwalters512 commented 4 years ago

That did the trick! Thanks much @johno 🙏