Babel plugin for Mithril JSX precompilation, converting JSX into Mithril virtual DOM nodes (e.g., {tag: 'div', attrs: {}, children: []}). Current stable version is 4.1.1. The plugin has evolved through major versions, with v4.0.0 changing whitespace trimming behavior and v4.1.0 adding jsxCompliant (attribute casing) and warnDeprecatedHtml options. It is the primary JSX compiler for Mithril v2+ and precompilation yields performance benefits over runtime interpretation.
npm install babel-plugin-mjsxVerified import paths — ran on the pinned version, not inferred.
Demonstrates Babel configuration and JSX-to-Mithril precompilation output.
Update to v4.0.0+ and adjust templates if whitespace matters.
Use 'warnDeprecatedHtml' instead of 'deprecated'.
Use 'mjsx' as plugin name in .babelrc or programmatic config.
Ensure your Mithril version is compatible or manually adjust output.
Use 'mjsx' in Babel config, not 'babel-plugin-mjsx'.
Replace 'deprecated' with 'warnDeprecatedHtml'.
Ensure JSX always returns a valid element or wrap conditionals with m() or fragment.