Skip to content

feat(sucrase): add support for jsxRuntime and other missing Sucrase options#1961

Open
vinny-silveira wants to merge 4 commits intorollup:masterfrom
vinny-silveira:master
Open

feat(sucrase): add support for jsxRuntime and other missing Sucrase options#1961
vinny-silveira wants to merge 4 commits intorollup:masterfrom
vinny-silveira:master

Conversation

@vinny-silveira
Copy link

Rollup Plugin Name: sucrase

This PR contains:

  • bugfix
  • feature
  • refactor
  • documentation
  • other

Are tests included?

  • yes (bugfixes and features will not be merged without tests)
  • no

Breaking Changes?

  • yes (breaking changes will not be merged unless absolutely necessary)
  • no

List any relevant issue numbers:

(No specific issues found, but this PR adds support for options that already exist in Sucrase but were not exposed in the plugin.)

Description

This PR adds support for missing Sucrase options that were not being passed through to the transform function:

  • jsxRuntime - Enables the automatic JSX runtime (React 17+);
  • jsxImportSource - Custom JSX import source (e.g., preact);
  • preserveDynamicImport - Preserve dynamic import expressions;
  • injectCreateRequireForImportRequire - Inject createRequire for import.meta.

Additionally, this PR includes:

  1. Refactor: Simplified the resolveId function by removing a redundant ternary operator (the importer check guarantees it's always truthy at that point);
  2. Tests: Added a getBundle helper function to reduce boilerplate in tests, plus new tests for plugin initialization and the exclude filter;
  3. Documentation: Updated README.md to list all available Sucrase options.

Copilot AI and others added 4 commits February 12, 2026 18:50
Co-authored-by: vinny-silveira <13592890+vinny-silveira@users.noreply.github.com>
Remove redundant ternary in resolveId (importer is always truthy), extract common rollup setup into getBundle helper function and add tests for plugin initialization and exclude filter
…port

Add support for jsxRuntime and other missing Sucrase transform options
Copilot AI review requested due to automatic review settings February 13, 2026 13:09

This comment was marked as spam.

@shellscape
Copy link
Collaborator

Sorry about the copilot noise. I have no idea how that got turned on. But please disregard it.

@vinny-silveira
Copy link
Author

No worries at all, @shellscape! Totally understand, thanks for the heads-up. Happy to make any changes if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants