Babel plugin to transpile optional require() calls for bundlers like Metro that lack native support. Current stable version 0.3.1, last updated in 2019; low release cadence. Differentiator: replaces missing modules with an error-throwing IIFE so try/catch works at runtime, supports whitelist/blacklist for resolving. Not actively maintained but functional for its niche.
npm install babel-plugin-optional-requireVerified import paths — ran on the pinned version, not inferred.
Configures Babel to transform optional require calls into IIFE-throwing for missing modules.
Wrap optional requires in try/catch as shown in README.
Use 'blocklist' and 'allowlist' if available; otherwise treat blacklist/whitelist as stable.
Use only string literal arguments for optional requires.
Run: yarn add --dev babel-plugin-optional-require
Upgrade to a compatible plugin version or use @babel/plugin-syntax-optional-require? Note: This plugin is for Babel 6 primarily.
No dependency data recorded yet.