Rewrite Imports Utility

JSON →
library 3.0.0 ·javascript
verified May 27, 2026

rewrite-imports is a lightweight (349B) utility designed to transform ECMAScript `import` statements into CommonJS `require()` calls using regular expressions. As of its current stable version, 3.0.0, it provides a performant way to transpile modules at the string level, without relying on an Abstract Syntax Tree (AST) parser. This makes it extremely fast and suitable for build-time processing in environments where a full AST transformation is overkill or undesired. The package typically sees minor updates and patches, with major versions introducing breaking changes like the shift to named exports in v3.0.0. Its primary differentiator is its simplicity and reliance on RegExp, offering a niche solution for projects that need a quick, no-frills import rewriting mechanism, particularly for older Node.js environments (>=6) or browser environments with a `require` shim. Unlike full module bundlers or transpilers, it solely performs string replacement and does not provide a runtime or evaluate the transformed code.

total hits 11
actors 6 distinct systems
last hit 7d ago Script
GPTBot
5
Script
1
ClaudeBot
1
Search engines
1

top countries 🇺🇸 United States · 🇫🇷 France · 🇨🇦 Canada · 🇩🇪 Germany