babel-plugin-replace-import-extension

JSON →
library 1.1.5 ·javascript
verified May 27, 2026

A Babel plugin that replaces file extensions in import statements and dynamic imports during transpilation. Current stable version is 1.1.5, with irregular release cadence. It solves the problem of co-existing ESModule and CommonJS builds by rewriting relative imports (starting with ./ or ../) so that, for example, .js becomes .mjs or .cjs. Unlike other extension replacement approaches, it handles dynamic imports by injecting a __transformExtension helper and avoids changes to bare specifiers (node_modules). It works with @babel/transform-modules-commonjs and is configured via an extMapping option.

total hits 17
actors 6 distinct systems
last hit 17h ago AhrefsBot
ByteDance
3
GPTBot
2
Script
1
Search engines
1
Humans
2

top countries 🇩🇪 Germany · 🇸🇬 Singapore · 🇺🇸 United States · 🇨🇦 Canada · 🇲🇽 Mexico