Registry / web-framework / babel-plugin-dynamic-import-node-babel-7

babel-plugin-dynamic-import-node-babel-7

JSON →
library2.0.7jsnpmunverified

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.

npm install babel-plugin-dynamic-import-node-babel-7
INSTALL
IMPORT
SIG · BABEL-PLUGIN-DYNAM
B
babel-plugin-dynamic-import-node-babel-7
web-frameworkjavascriptv2.0.7
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.

plugin (default)
module.exports = { plugins: ['dynamic-import-node-babel-7'] }
import plugin from 'babel-plugin-dynamic-import-node-babel-7'
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.
require (CommonJS)
const dynamicImportPlugin = require('babel-plugin-dynamic-import-node-babel-7');
import dynamicImportPlugin from 'babel-plugin-dynamic-import-node-babel-7';
This package is CJS-only; ES module import is not supported. Use require() in Node.js.

Shows Babel configuration and how dynamic import() is transformed to deferred require() for Node.

// Install: npm install --save-dev babel-plugin-dynamic-import-node-babel-7 // .babelrc { "plugins": ["dynamic-import-node-babel-7"] } // Source code async function loadModule() { const module = await import('./some-module'); return module; } // After transpilation (Node) function loadModule() { return Promise.resolve().then(() => require('./some-module')); }
Debug
Known issues
deprecatedThis fork may not receive updates; prefer the original airbnb plugin or @babel/plugin-syntax-dynamic-import with a dynamic import polyfill.
fix
Use the official @babel/plugin-syntax-dynamic-import for parsing, and a runtime polyfill like dynamic-import-polyfill if needed.
affects: >=2.0.0
gotchaThe plugin name in .babelrc is 'dynamic-import-node-babel-7', not 'dynamic-import-node' (original plugin name).
fix
Ensure the plugin string matches the package name: "dynamic-import-node-babel-7".
affects: >=2.0.0
breakingBabel 7 changed plugin API; this fork may not be compatible with Babel 6 or future Babel versions.
fix
Use only with Babel 7. For Babel 6, use the original `babel-plugin-dynamic-import-node`.
affects: >=2.0.0
Errors
Common errors & fixes
Error: Cannot find module 'babel-plugin-dynamic-import-node-babel-7'
Plugin not installed or package name misspelled in configuration.
fix
Run `npm install --save-dev babel-plugin-dynamic-import-node-babel-7` and check .babelrc for correct name.
Support for the experimental syntax 'importMeta' isn't currently enabled
Babel not configured to parse dynamic import syntax; this plugin only transforms, it doesn't parse.
fix
Add '@babel/plugin-syntax-dynamic-import' to plugins list in addition to this plugin.
Upgrade
Version history
2.0.7latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
18 hits · last 30 days
node
16
OpenAI (training)
1
Resources
babel-plugin-dynamic-import-node-babel-7 — npm install babel-plugin-dynamic-import-node-babel-7 · libregistry