Skip to content

@blocknote/math-block cannot be imported in Node because its entry imports KaTeX's CSS #3228

Closed

Description

@ihordubas99

What’s broken?

@blocknote/math-block cannot be loaded in Node, so it cannot be used with ServerBlockNoteEditor from @blocknote/server-util (for example to export documents with equations to Markdown on the server).

Its entry dist/blocknote-math-block.js imports the KaTeX stylesheet as a side effect:

import "katex/dist/katex.min.css";

Node fails on that import:

TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".css" for …/node_modules/katex/dist/katex.min.css

The same import also breaks some browser bundlers. Angular's esbuild based production build fails with "No loader is configured for .woff2", once for every KaTeX font the stylesheet references (seen with 0.54.2).

What did you expect to happen?

The package can be imported in Node, and the server side Markdown export of math blocks and inline math works. When the CSS import is stubbed out, the package loads and the export produces the expected $$…$$ and $…$.

A possible fix is to ship the stylesheet as a separate export (like @blocknote/mantine/style.css) that consumers import themselves.

Steps to reproduce

  1. Install the packages

    npm i @blocknote/core@0.56.0 @blocknote/server-util@0.56.0 @blocknote/math-block@0.56.0 react@19 react-dom@19 yjs y-prosemirror y-protocols
  2. Save as repro.mjs and run node repro.mjs

    import { BlockNoteSchema } from "@blocknote/core";
    import { ServerBlockNoteEditor } from "@blocknote/server-util";
    import { createReactMathBlockSpec } from "@blocknote/math-block";
    
    const schema = BlockNoteSchema.create().extend({
      blockSpecs: { mathBlock: createReactMathBlockSpec() },
    });
    const editor = ServerBlockNoteEditor.create({ schema });
    console.log(await editor.blocksToMarkdownLossy([{ type: "mathBlock", content: "a^2" }]));
  3. Node throws ERR_UNKNOWN_FILE_EXTENSION on katex.min.css

BlockNote version

0.54.2, 0.55.0 and 0.56.0

Environment

Node 24.18, React 19.3

Additional context

We use BlockNote in OpenProject with a Hocuspocus server that stores a Markdown copy of each document. As a workaround, we mirror the math specs on the server with static specs built with createBlockSpec.

Contribution

  • I'd be interested in contributing a fix for this issue

Sponsor

  • I'm a sponsor and would appreciate if you could look into this sooner than later 💖

Activity

  1. added
    needs-triage
    on Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions