babel-plugin-transform-runtime-file-extensions

A Babel plugin that adds file extensions to Babel runtime import specifiers and require paths for Node.js ESM compatibility.


Keywords
babel, plugin, transform, import, require, runtime, file, extensions, mjs, esm, node
License
MIT
Install
npm install babel-plugin-transform-runtime-file-extensions@2.0.0

Documentation

babel-plugin-transform-runtime-file-extensions

npm version CI status

A Babel plugin that adds file extensions to Babel runtime import specifiers and require paths for Node.js ESM compatibility.

This is a temporary workaround for babel/babel#8462.

Setup

To install from npm run:

npm install babel-plugin-transform-runtime-file-extensions --save-dev

Configure Babel to use the plugin, after @babel/plugin-transform-runtime:

{
  "plugins": ["@babel/transform-runtime", "transform-runtime-file-extensions"]
}