A Babel plugin (v1.2.0, last updated 2019) that transforms ES module imports into lazily loaded, memoized CommonJS requires, deferring require() calls until the imported identifier is actually referenced. Unlike the standard babel-plugin-transform-es2015-modules-commonjs, this avoids upfront I/O and execution costs for imported modules. Maintained by the author of babel-plugin-module-resolver, but now in maintenance mode as most projects have moved to @babel/preset-env or other bundlers. Supports options like excludeModules and excludeNodeBuiltins to skip lazy loading for specific modules or Node builtins. No TypeScript types, minimal breaking changes across versions.
npm install babel-plugin-transform-inline-imports-commonjsVerified import paths — ran on the pinned version, not inferred.
Shows Babel plugin configuration with exclusion options and a sample import that gets lazily loaded.
Migrate to @babel/preset-env or @babel/plugin-transform-modules-commonjs with babel-plugin-lazy-require or similar.
Use 'excludeModules' instead of 'exclude' in plugin options.
Order plugins correctly: transform-inline-imports-commonjs should come before transform-runtime in your plugin list.
Use the 'excludeModules' option to skip lazy loading for modules involved in circular dependencies.
Ensure you are using Babel 6 with this plugin. For Babel 7, use a different module transformation plugin.
Run: npm install --save-dev babel-plugin-transform-inline-imports-commonjs and verify the name in .babelrc.