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-specifiedVerified import paths — ran on the pinned version, not inferred.
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.
Manually add file extensions to dynamic import() calls, or use a different plugin that handles dynamic imports.
Update to v1.1.2+ which fixes this behavior to prioritize files before directories.
Only include packages that are known to be ESM and require fully-specified imports; test thoroughly after enabling.
Monitor the repository for breaking changes; currently remains in use as of v1.3.1.
Configure the Babel plugin to add extensions during build, or manually add the correct extension (e.g., './path/index.js').
Run 'npm install --save-dev babel-plugin-fully-specified' from the project root where babel.config.js resides.
Use require('babel-plugin-fully-specified') or reference it as a string in plugins array.