oven-sh/bun · error · anyhow::Error

Failed to compile MDX: {:?}

Error message

Failed to compile MDX: {:?}

What it means

Error "Failed to compile MDX: {:?}" thrown in oven-sh/bun.

Source

Thrown at packages/bun-build-mdx-rs/src/lib.rs:20

use mdxjs::{compile, Options as CompileOptions};
use napi_derive::napi;

define_bun_plugin!("bun-mdx-rs");

#[bun]
pub fn bun_mdx_rs(handle: &mut OnBeforeParse) -> Result<()> {
  let source_str = handle.input_source_code()?;

  let mut options = CompileOptions::gfm();

  // Leave it as JSX for Bun to handle
  options.jsx = true;

  let path = handle.path()?;
  options.filepath = Some(path.to_string());

  let jsx = compile(&source_str, &options)
    .map_err(|e| anyhow::anyhow!("Failed to compile MDX: {:?}", e))?;

  handle.set_output_source_code(jsx, BunLoader::BUN_LOADER_JSX);

  Ok(())
}

View on GitHub (pinned to 8c5296ac45)

When it happens

Trigger: Thrown at packages/bun-build-mdx-rs/src/lib.rs:20 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of oven-sh/bun@8c5296ac45 (2026-08-16). Data as JSON: /api/errors/e884d16c3af2e667. Report an issue: GitHub.