You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
@blocknote/math-block cannot be imported in Node because its entry imports KaTeX's CSS #3228
@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
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
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