{"id":25970,"library":"mxn-jsx-transpiler","title":"mxn-jsx-transpiler","description":"Transpiles JSX to regular JavaScript. Current stable version is 0.8.7. This package is a lightweight JSX-to-JavaScript transpiler (~6.1kb, ~2.5kb gzipped) that converts JSX syntax into function calls. It offers configuration options like factory function, property quoting, and indentation. Unlike Babel or TypeScript, it is minimal and focused on standalone JSX transpilation without a full AST transformation. It uses CommonJS and is intended for Node.js environments.","status":"active","version":"0.8.7","language":"javascript","source_language":"en","source_url":"https://github.com/ZimNovich/mxn-jsx-transpiler","tags":["javascript","jsx","react","transpile","transpiler","transform","ast","vdom"],"install":[{"cmd":"npm install mxn-jsx-transpiler","lang":"bash","label":"npm"},{"cmd":"yarn add mxn-jsx-transpiler","lang":"bash","label":"yarn"},{"cmd":"pnpm add mxn-jsx-transpiler","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"CJS only; does not support ES module imports.","wrong":"import transpile from 'mxn-jsx-transpiler'","symbol":"transpile","correct":"const transpile = require('mxn-jsx-transpiler')"},{"note":"The module exports a single function directly, not as a named export.","wrong":"const { transpile } = require('mxn-jsx-transpiler')","symbol":"transpile (default export)","correct":"const transpile = require('mxn-jsx-transpiler')"},{"note":"Options are passed as an object, not positional arguments.","wrong":"transpile(code, 'h')","symbol":"transpile options","correct":"transpile(code, { factory: 'h', quotePropNames: true })"}],"quickstart":{"code":"const transpile = require('mxn-jsx-transpiler');\n\nconst code = `\nconst element = <div id=\"app\">Hello, JSX!</div>;\n`;\n\nconst options = {\n  factory: 'h',\n  quotePropNames: true,\n  indent: '  ',\n  lineEnd: '\\n'\n};\n\nconst result = transpile(code, options);\nconsole.log(result);\n// Output:\n// const element = h(\"div\", { \"id\": \"app\" }, \"Hello, JSX!\");\n","lang":"javascript","description":"Shows how to require the module and transpile a simple JSX element with custom options."},"warnings":[{"fix":"Use CommonJS require() or a bundler that can handle CJS.","message":"The package does not support ESM imports; use require() only.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Set factory option to 'React.createElement' if using React.","message":"The factory function default is 'h', not 'React.createElement'. Ensure your runtime provides this function.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Always pass options as: transpile(code, { factory: '...' })","message":"Options must be passed as an object; positional arguments will be ignored.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use const transpile = require('mxn-jsx-transpiler') instead of import.","cause":"Incorrect import: using ES import syntax with a CJS module.","error":"TypeError: transpile is not a function"},{"fix":"Either define a function h, or set factory option to your actual function, e.g., React.createElement.","cause":"Using default factory 'h' without defining it in runtime.","error":"ReferenceError: h is not defined"},{"fix":"Ensure you call transpile(code) before executing the code, and that the code string contains JSX.","cause":"The input code contains JSX but the transpiler was not applied.","error":"SyntaxError: Unexpected token '<'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}