Registry / serialization / babel-plugin-transform-modern-regexp

babel-plugin-transform-modern-regexp

JSON →
library0.0.6jsnpmunverified

Babel plugin that transpiles modern RegExp features (dotAll s-flag, named capturing groups, extended x-flag) down to ES5-compatible JavaScript. Current stable version is 0.0.6, last updated in 2019. This plugin has low maintenance cadence and is based on the regexp-tree library. It is a non-standard package, not affiliated with Babel core, and mostly useful for projects that need to support older JavaScript engines without native support for these features.

npm install babel-plugin-transform-modern-regexp
INSTALL
IMPORT
SIG · BABEL-PLUGIN-TRANS
B
babel-plugin-transform-modern-regexp
serializationjavascriptv0.0.6
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
module.exports = require('babel-plugin-transform-modern-regexp'); // or in .babelrc plugins array
import plugin from 'babel-plugin-transform-modern-regexp'; // Not a typical ES module
This is a CommonJS module typically used as a Babel plugin string, not imported directly.
N/A
No direct named exports. Used via Babel configuration as 'transform-modern-regexp'.

Shows Babel configuration enabling dotAll and named groups features, and a sample transformation.

// .babelrc { "plugins": [ ["transform-modern-regexp", { "features": ["dotAll", "namedCapturingGroups", "xFlag"] }] ] } // Input const regex = /(?<name>\w+)\k<name>/s; // Output const regex = /([\0-\uFFFF])\1/;
Debug
Known issues
deprecatedPackage is unmaintained since 2019 and does not support modern Babel versions (7.x+).
fix
Use native RegExp features or a more actively maintained plugin like @babel/plugin-proposal-unicode-property-regex.
affects: >0.0.6
gotchaRequires regexp-tree package as a direct dependency but is not included in the plugin's package.json dependencies list (it's a peer dependency).
fix
Manually install regexp-tree: npm install regexp-tree --save-dev.
affects: 0.0.6
gotchaThe xFlag feature transforms extended regexes but only works with new RegExp() calls, not regex literals.
fix
Use new RegExp(pattern, 'x') syntax for extended flag.
affects: >=0
gotchaPlugin options are passed as an array item, not as a separate object in .babelrc plugins array.
fix
Use ["transform-modern-regexp", { ... }] structure.
affects: >=0
Errors
Common errors & fixes
Error: Plugin transform-modern-regexp: Unknown plugin "transform-modern-regexp"
Babel >=7 does not find the plugin in node_modules or it's not installed.
fix
Install the plugin: npm install babel-plugin-transform-modern-regexp --save-dev
TypeError: Cannot read property 'features' of undefined
Plugin options are malformed; missing plugin object.
fix
Use correct format in .babelrc: ["transform-modern-regexp", { "features": [...] }]
Error: Cannot find module 'regexp-tree'
regexp-tree is a peer dependency of the plugin but not automatically installed.
fix
Run: npm install regexp-tree --save-dev
Upgrade
Version history
0.0.6latest on npm
Audit
Dependencies
regexp-treerequiredCore library for regex parsing and transformation
Agent activity
17 hits · last 30 days
node
14
OpenAI (training)
2
Resources
babel-plugin-transform-modern-regexp — npm install babel-plugin-transform-modern-regexp · libregistry