-
Notifications
You must be signed in to change notification settings - Fork 1
require() in ESM module breaks in strict ESM environments #1
Copy link
Copy link
Open
Description
Description
The library uses require() in src/inline-renderer.ts:89 to avoid circular dependencies:
const { renderBlock } = require('./block-renderer.js');However, require() is not available in strict ESM environments:
- Bun
- Deno
- Node.js with
--experimental-vm-modules - Bundlers in strict ESM mode
This causes a ReferenceError: require is not defined when rendering footnotes.
Steps to Reproduce
- Use the library in Bun or Deno
- Convert a Markdown document containing footnotes
- Error is thrown
Expected Behavior
The library should work in all ESM-compatible environments.
Suggested Fix
Replace require() with dependency injection - pass renderBlock through the RenderContext object. This maintains the circular import avoidance while being fully ESM-compatible.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels