{"id":22103,"library":"rollup-plugin-jsx","title":"rollup-plugin-jsx","description":"A Rollup plugin that transforms JSX syntax into JavaScript using jsx-transform. Version 1.0.3 is the latest stable release, with no recent updates. It allows configuring JSX factory functions and pragma options. Compared to alternatives like @rollup/plugin-babel with React preset or @rollup/plugin-sucrase, it is a lightweight, zero-config option for simple JSX transformation without full Babel setup. However, it is a thin wrapper around an unmaintained library (jsx-transform) and may not support modern JSX features like automatic runtime; it is best suited for legacy projects.","status":"maintenance","version":"1.0.3","language":"javascript","source_language":"en","source_url":"https://github.com/konsumer/rollup-plugin-jsx","tags":["javascript","rollup-plugin","jsx","react"],"install":[{"cmd":"npm install rollup-plugin-jsx","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-jsx","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-jsx","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core dependency for JSX transformation; provides the actual transform logic.","package":"jsx-transform","optional":false}],"imports":[{"note":"ES module import; CommonJS require also works as the package has a default export.","wrong":"const jsx = require('rollup-plugin-jsx')","symbol":"jsx","correct":"import jsx from 'rollup-plugin-jsx'"},{"note":"In CommonJS, the default export is accessed via .default. The module is not ESM-only.","wrong":"const jsx = require('rollup-plugin-jsx')","symbol":"jsx","correct":"const jsx = require('rollup-plugin-jsx').default"},{"note":"There is no named export; use default import.","wrong":"import { jsx } from 'rollup-plugin-jsx'","symbol":"jsx","correct":"import jsx from 'rollup-plugin-jsx'; // default export"}],"quickstart":{"code":"import jsx from 'rollup-plugin-jsx';\n\nexport default {\n  input: 'src/index.js',\n  output: {\n    file: 'bundle.js',\n    format: 'iife',\n  },\n  plugins: [\n    jsx({\n      factory: 'React.createElement',\n      pragma: 'h',\n    }),\n  ],\n};","lang":"javascript","description":"Shows how to configure rollup-plugin-jsx with a custom factory and pragma for JSX transformation in a Rollup build."},"warnings":[{"fix":"Consider using @rollup/plugin-babel with @babel/preset-react or @rollup/plugin-sucrase for full JSX support.","message":"The underlying jsx-transform library is unmaintained; may not support modern JSX features like automatic runtime (React 17+).","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use 'factory' option instead of 'pragma'.","message":"The 'pragma' option is deprecated in favor of 'factory' in some future versions. Check compatibility.","severity":"deprecated","affected_versions":"<1.0.0"},{"fix":"Ensure the plugin is listed before other transforms in the Rollup config.","message":"Source maps may not work correctly if the plugin is not placed correctly in the plugin array (should be before any minification).","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run npm install jsx-transform","cause":"Missing peer dependency jsx-transform","error":"Error: Could not resolve 'jsx-transform'"},{"fix":"Use `import jsx from 'rollup-plugin-jsx'` (default import) instead of `import { jsx } from 'rollup-plugin-jsx'`","cause":"Incorrect import: using named import instead of default","error":"TypeError: jsx is not a function"},{"fix":"Include React as a dependency, use an external globals, or use @rollup/plugin-node-resolve","cause":"JSX output expects React to be globally available but it's not bundled","error":"Module not found: Can't resolve 'react' in '...'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}