Registry / serialization / babel-plugin-fully-specified

babel-plugin-fully-specified

JSON →
library1.3.1jsnpmunverified

A Babel plugin (v1.3.1) that automatically adds mandatory file extensions to import paths, transforming bare specifiers like './path' into fully-specified paths like './path/index.js'. It targets authors of ESM packages with 'type': 'module' in package.json, ensuring compliance with Node.js ESM mandatory file extension rules. The plugin resolves directory imports to index files with the correct extension, supports TypeScript/TSX, and offers options for custom extension lists and package inclusion. Alternative tools include manual rewriting or other Babel plugins, but this plugin's focus on batch transformation for build pipelines sets it apart. Released in Jan 2026, it has active maintenance and supports dynamic import detection but not transformation.

npm install babel-plugin-fully-specified
INSTALL
IMPORT
SIG · BABEL-PLUGIN-FULLY
B
babel-plugin-fully-specified
serializationjavascriptv1.3.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

default
module.exports = require('babel-plugin-fully-specified')
import fullySpecified from 'babel-plugin-fully-specified'
This is a CommonJS plugin; in Node.js, use require(). In browser-based transforms, typically used via babel.config.js where require() is standard.
babel-plugin-fully-specified
plugins: ['babel-plugin-fully-specified']
plugins: [require('babel-plugin-fully-specified')]
In Babel configuration, string references auto-resolve. Explicitly requiring it is unnecessary and may cause issues with Babel's plugin resolution if the plugin is not installed at the config's location.
BabelPluginFullySpecified
import { BabelPluginFullySpecified } from 'babel-plugin-fully-specified'; plugins: [BabelPluginFullySpecified]
This plugin does not export any named symbol; only the default export is available. Importing a named symbol will result in undefined.

Configures babel-plugin-fully-specified in babel.config.js with all available options, showing how it transforms a directory import into a fully-specified index.js import.

// Install: npm install --save-dev babel-plugin-fully-specified @babel/core // In babel.config.js: module.exports = { plugins: [ ['babel-plugin-fully-specified', { ensureFileExists: false, esExtensionDefault: '.js', tryExtensions: ['.js', '.mjs', '.cjs'], esExtensions: ['.js', '.mjs', '.cjs'], includePackages: [], }] ] }; // Input: import { Thing } from './path'; // Output: import { Thing } from './path/index.js';
Debug
Known issues
breakingDynamic imports are not transformed; they will remain bare-specified.
fix
Manually add file extensions to dynamic import() calls, or use a different plugin that handles dynamic imports.
affects: <=1.3.1
gotchaPlugin may incorrectly prioritize file over directory when both exist (e.g., './path' and './path.js'), potentially resolving to the file without index extension.
fix
Update to v1.1.2+ which fixes this behavior to prioritize files before directories.
affects: <1.1.2
breakingFor packages listed in includePackages, the plugin adds extensions to all imports from those packages, which may break Node.js resolution for packages that are not fully-specified already.
fix
Only include packages that are known to be ESM and require fully-specified imports; test thoroughly after enabling.
affects: >=1.2.0 <=1.3.1
deprecatedThe option 'esExtensionDefault' may be renamed in future versions; check changelog for updates.
fix
Monitor the repository for breaking changes; currently remains in use as of v1.3.1.
affects: >=1.0.0
Errors
Common errors & fixes
Module not found: Error: Can't resolve './path' in '/path/to/file'
Bare import without extension in ESM context; Node.js requires fully-specified paths for ESM.
fix
Configure the Babel plugin to add extensions during build, or manually add the correct extension (e.g., './path/index.js').
Error: Cannot find module 'babel-plugin-fully-specified'
Plugin not installed or not in the same node_modules resolution chain as babel.
fix
Run 'npm install --save-dev babel-plugin-fully-specified' from the project root where babel.config.js resides.
TypeError: (0 , _fullySpecified.default) is not a function
Attempting to import the plugin as a default ES import instead of using CommonJS require.
fix
Use require('babel-plugin-fully-specified') or reference it as a string in plugins array.
Upgrade
Version history
1.3.1latest on npm
Audit
Dependencies
@babel/corerequiredRequired as a peer dependency for plugin execution; the plugin is loaded by Babel which must be present in the project.
Agent activity
18 hits · last 30 days
node
14
OpenAI (training)
2
Resources
babel-plugin-fully-specified — npm install babel-plugin-fully-specified · libregistry