{"id":19045,"library":"babel-plugin-dynamic-import-node-babel-7","title":"babel-plugin-dynamic-import-node-babel-7","description":"A Babel plugin that transpiles dynamic import() expressions to deferred require() calls for Node.js environments. This version (2.0.7) is a fork of the original airbnb plugin updated to support Babel 7. It matches the proposed import() spec and requires Babylon >= v6.12.0 to correctly parse dynamic imports. Key differentiators: specifically targets Node.js (not browsers), uses deferred require() to preserve lazy loading semantics, and is a drop-in replacement for the Babel 6 version. Maintenance status: a fork created to test Babel 7 compatibility; users should consider the official airbnb version or alternative dynamic import transforms for production.","status":"active","version":"2.0.7","language":"javascript","source_language":"en","source_url":"https://github.com/mike3run/babel-plugin-dynamic-import-node-babel-7","tags":["javascript","babel","plugin","dynamic","import","node"],"install":[{"cmd":"npm install babel-plugin-dynamic-import-node-babel-7","lang":"bash","label":"npm"},{"cmd":"yarn add babel-plugin-dynamic-import-node-babel-7","lang":"bash","label":"yarn"},{"cmd":"pnpm add babel-plugin-dynamic-import-node-babel-7","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The plugin is used as a string in Babel configuration, not imported directly in code. For programmatic use, require the package and pass as plugin.","wrong":"import plugin from 'babel-plugin-dynamic-import-node-babel-7'","symbol":"plugin (default)","correct":"module.exports = { plugins: ['dynamic-import-node-babel-7'] }"},{"note":"This package is CJS-only; ES module import is not supported. Use require() in Node.js.","wrong":"import dynamicImportPlugin from 'babel-plugin-dynamic-import-node-babel-7';","symbol":"require (CommonJS)","correct":"const dynamicImportPlugin = require('babel-plugin-dynamic-import-node-babel-7');"}],"quickstart":{"code":"// Install: npm install --save-dev babel-plugin-dynamic-import-node-babel-7\n// .babelrc\n{\n  \"plugins\": [\"dynamic-import-node-babel-7\"]\n}\n\n// Source code\nasync function loadModule() {\n  const module = await import('./some-module');\n  return module;\n}\n\n// After transpilation (Node)\nfunction loadModule() {\n  return Promise.resolve().then(() => require('./some-module'));\n}","lang":"javascript","description":"Shows Babel configuration and how dynamic import() is transformed to deferred require() for Node."},"warnings":[{"fix":"Use the official @babel/plugin-syntax-dynamic-import for parsing, and a runtime polyfill like dynamic-import-polyfill if needed.","message":"This fork may not receive updates; prefer the original airbnb plugin or @babel/plugin-syntax-dynamic-import with a dynamic import polyfill.","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Ensure the plugin string matches the package name: \"dynamic-import-node-babel-7\".","message":"The plugin name in .babelrc is 'dynamic-import-node-babel-7', not 'dynamic-import-node' (original plugin name).","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Use only with Babel 7. For Babel 6, use the original `babel-plugin-dynamic-import-node`.","message":"Babel 7 changed plugin API; this fork may not be compatible with Babel 6 or future Babel versions.","severity":"breaking","affected_versions":">=2.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run `npm install --save-dev babel-plugin-dynamic-import-node-babel-7` and check .babelrc for correct name.","cause":"Plugin not installed or package name misspelled in configuration.","error":"Error: Cannot find module 'babel-plugin-dynamic-import-node-babel-7'"},{"fix":"Add '@babel/plugin-syntax-dynamic-import' to plugins list in addition to this plugin.","cause":"Babel not configured to parse dynamic import syntax; this plugin only transforms, it doesn't parse.","error":"Support for the experimental syntax 'importMeta' isn't currently enabled"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}