A standalone JSX transpiler that desugars JSX into JavaScript, decoupled from React. Version 2.0.3 is the current stable release; the project is in maintenance mode. It is a rewrite of jsx-transform using acorn for parsing, aiming to be a drop-in replacement with the same API. Unlike Babel's JSX plugin, it requires no React dependency and offers configurable factory functions, spread handling, and unknown tag patterns. It provides three main functions: fromString, fromFile, and browserifyTransform. It supports Node.js and browser environments, though browser usage typically requires a bundler. Releases are infrequent, with no recent updates. Preferred over babel for minimal, non-React JSX transformations.
npm install jsx-transform-modernNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic usage of fromString and fromFile with custom factory and options.
Pass { arrayChildren: false } to match React behavior.Set { passUnknownTagsToFactory: true } to pass them as objects to factory, or { unknownTagsAsString: true } to pass as strings.Set { ecmaversion: 2020 } or the appropriate ECMAScript version.Test your code when upgrading from 1.x; check for parsing errors or output differences.
Ensure you have set the spreadFn option, or use a babel-based transformer if spread is heavily used.
Run 'npm install jsx-transform-modern' which will install acorn as a dependency.
Use import { fromString } from 'jsx-transform-modern' or const { fromString } = require('jsx-transform-modern').