Registry / serialization / babel-plugin-system-import

babel-plugin-system-import

JSON →
library1.1.5jsnpmunverified

Babel plugin that transforms System.import() calls (and import() since v3) into a UMD-compatible pattern using Promise. Originally for Babel 5/6, now supports Babel 7 (v4). Key differentiator: it generates a runtime pattern that works across AMD, CommonJS, and global module formats without requiring a module bundler. Stable version 1.1.5 (legacy) with newer major versions for Babel 6 (v2) and Babel 7 (v4). Automatically detects module target (amd/commonjs) and strips unnecessary format detection. Maintenance mode; consider dynamic import with webpack/rollup instead.

npm install babel-plugin-system-import
INSTALL
IMPORT
SIG · BABEL-PLUGIN-SYSTE
B
babel-plugin-system-import
serializationjavascriptv1.1.5
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

default export
module.exports = require('babel-plugin-system-import-transformer')
import systemImport from 'babel-plugin-system-import-transformer'
Plugin is CommonJS only; use require in babel.config.js
Plugin in .babelrc
{"plugins": ["system-import-transformer"]}
{"plugins": ["system-import"]}
Plugin name in Babel config is 'system-import-transformer', not 'system-import'
Plugin with options
{"plugins": [["system-import-transformer", {"commonJS": true}]]}
{"plugins": ["system-import-transformer", {"commonJS": true}]}
Options must be in a sub-array: [plugin, options]

Demonstrates transforming System.import() into a UMD-compatible promise pattern using the plugin.

// Install: npm install babel-plugin-system-import-transformer // In .babelrc or babel.config.js: { "plugins": ["system-import-transformer"] } // Input: System.import('./utils/serializer').then(function(module){ console.log(module); }); // Output: new Promise(function (resolve, reject) { var global = window; if (typeof global.define === 'function' && global.define.amd) { global.require(['utilsSerializer'], resolve, reject); } else if (typeof module !== 'undefined' && (module.exports && typeof require !== 'undefined') || typeof module !== 'undefined' && (module.component && (global.require && global.require.loader === 'component'))) { resolve(require('./utils/serializer')); } else { resolve(global['utilsSerializer']); } }).then(function(module){ console.log(module); });
Debug
Known issues
breakingv2.0.0 dropped Babel 5 support; only works with Babel 6+.
fix
Upgrade to v2+ if using Babel 6, or pin to v1.x for Babel 5.
affects: <2.0.0
breakingv4.0.0 requires Babel 7; incompatible with Babel 6.
fix
Use v3.x for Babel 6, or upgrade your Babel to v7.
affects: >=4.0.0
gotchaThe plugin transforms only System.import() and import() (v3+); it does not transform require() or define() calls.
fix
Use a different plugin (e.g., babel-plugin-transform-modules-umd) for other module formats.
affects: *
deprecatedSystem.import() is deprecated in modern browsers and Node.js; consider using dynamic import() instead.
fix
Replace System.import() with import() and use a plugin that targets dynamic imports (e.g., @babel/plugin-syntax-dynamic-import).
affects: *
Errors
Common errors & fixes
Error: Could not find plugin "system-import-transformer".
Plugin not installed or misspelled in Babel config.
fix
Run `npm install babel-plugin-system-import-transformer --save-dev` and ensure config uses "system-import-transformer".
TypeError: Cannot read property 'import' of undefined
Plugin version mismatch with Babel version (e.g., using v4 with Babel 6).
fix
Install matching version: v3.x for Babel 6, v4.x for Babel 7.
Upgrade
Version history
1.1.5latest on npm
Audit
Dependencies
@babel/corerequiredRequired to use as a Babel plugin
Agent activity
21 hits · last 30 days
node
18
OpenAI (training)
1
Resources
babel-plugin-system-import — npm install babel-plugin-system-import · libregistry