Skip to content

Add require runtime import option#287

Open
dicnunz wants to merge 1 commit into
gajus:masterfrom
dicnunz:issue-207-require-runtime-import
Open

Add require runtime import option#287
dicnunz wants to merge 1 commit into
gajus:masterfrom
dicnunz:issue-207-require-runtime-import

Conversation

@dicnunz
Copy link
Copy Markdown

@dicnunz dicnunz commented May 9, 2026

Fixes https://github.com/gajus/flow-runtime/issues/207\n\nIssueHunt bounty: https://issuehunt.io/r/gajus/flow-runtime/issues/207\n\n## What changed\n- Added a new libraryImport option for babel-plugin-flow-runtime, defaulting to the existing ES module import output.\n- When libraryImport: 'require' is set, the plugin emits const t = require('flow-runtime') instead of import t from 'flow-runtime'.\n- Reuses an existing required runtime binding instead of adding a duplicate import, and keeps libraryName working for custom runtime packages.\n- Documented the new option.\n\n## Tested\n- yarn --cwd packages/babel-plugin-flow-runtime test\n- yarn --cwd packages/babel-plugin-flow-runtime build\n- yarn --cwd packages/babel-plugin-flow-runtime lint (exits 0 with existing jsx-a11y rule warnings)\n- git diff --check


IssueHunt Summary

Referenced issues

This pull request has been submitted to:


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.

Use require instead of import

1 participant