Registry / babel-plugin-transform-jscript

babel-plugin-transform-jscript

JSON →
library6.22.0jsnpmunverified

Babel plugin that fixes buggy named function expressions in JScript (IE<=8). This is an older Babel 6 plugin (v6.22.0), part of Babel's preset-es2015. It wraps named function expressions in an IIFE to avoid JScript's incorrect hoisting behavior. Not needed for modern browsers or Node.js. The plugin has no active maintenance as Babel 6 is superseded by Babel 7+; alternatives include using @babel/preset-env with the 'ie' target.

npm install babel-plugin-transform-jscript
INSTALL
IMPORT
SIG · BABEL-PLUGIN-TRANS
B
babel-plugin-transform-jscript
javascriptv6.22.0
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.

default
import plugin from 'babel-plugin-transform-jscript'
const plugin = require('babel-plugin-transform-jscript')
Babel 6 plugins are CommonJS, but import works with bundlers. For .babelrc, just use the string 'transform-jscript'.

Demonstrates how to enable the plugin via .babelrc and shows the transformation of a named function expression to an IIFE to fix JScript hoisting.

// .babelrc { "plugins": ["transform-jscript"] } // input.js var foo = function bar() {}; // output.js var foo = (function() { var bar = function() {}; return bar; })();
Debug
Known issues
deprecatedThis plugin is for Babel 6 only and is no longer maintained. Use @babel/preset-env with the 'ie' option instead.
fix
Upgrade to Babel 7+ and use @babel/preset-env targeting 'ie 8' or similar.
affects: >=6.0.0
gotchaThe plugin only transforms named function expressions with the 'var' assignment pattern. Other patterns like object property assignments are not handled.
fix
Ensure your code uses var foo = function bar() {} to be transformed.
affects: *
Errors
Common errors & fixes
Cannot find module 'babel-plugin-transform-jscript'
Package not installed or Babel 7+ is used (plugin name changed).
fix
Run 'npm install babel-plugin-transform-jscript' for Babel 6, or use @babel/plugin-transform-jscript for Babel 7+ (if available) but it's likely not needed.
Error: Cannot find module 'babel-core' from '...'
Using Babel 6 API with Node API but babel-core not installed.
fix
Ensure 'babel-core' is installed: npm install babel-core
Upgrade
Version history
6.22.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
babel-plugin-transform-jscript — npm install babel-plugin-transform-jscript · libregistry