{"id":19201,"library":"babel-plugin-transform-jscript","title":"babel-plugin-transform-jscript","description":"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.","status":"deprecated","version":"6.22.0","language":"javascript","source_language":"en","source_url":"https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-jscript","tags":["javascript","babel-plugin"],"install":[{"cmd":"npm install babel-plugin-transform-jscript","lang":"bash","label":"npm"},{"cmd":"yarn add babel-plugin-transform-jscript","lang":"bash","label":"yarn"},{"cmd":"pnpm add babel-plugin-transform-jscript","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Babel 6 plugins are CommonJS, but import works with bundlers. For .babelrc, just use the string 'transform-jscript'.","wrong":"const plugin = require('babel-plugin-transform-jscript')","symbol":"default","correct":"import plugin from 'babel-plugin-transform-jscript'"}],"quickstart":{"code":"// .babelrc\n{\n  \"plugins\": [\"transform-jscript\"]\n}\n// input.js\nvar foo = function bar() {};\n// output.js\nvar foo = (function() {\n  var bar = function() {};\n  return bar;\n})();","lang":"javascript","description":"Demonstrates how to enable the plugin via .babelrc and shows the transformation of a named function expression to an IIFE to fix JScript hoisting."},"warnings":[{"fix":"Upgrade to Babel 7+ and use @babel/preset-env targeting 'ie 8' or similar.","message":"This plugin is for Babel 6 only and is no longer maintained. Use @babel/preset-env with the 'ie' option instead.","severity":"deprecated","affected_versions":">=6.0.0"},{"fix":"Ensure your code uses var foo = function bar() {} to be transformed.","message":"The plugin only transforms named function expressions with the 'var' assignment pattern. Other patterns like object property assignments are not handled.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"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.","cause":"Package not installed or Babel 7+ is used (plugin name changed).","error":"Cannot find module 'babel-plugin-transform-jscript'"},{"fix":"Ensure 'babel-core' is installed: npm install babel-core","cause":"Using Babel 6 API with Node API but babel-core not installed.","error":"Error: Cannot find module 'babel-core' from '...'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}