babel/packages/babel-plugin-transform-es2015-block-scoping
Amjad Masad 77c7cc5363 Rework scope info updating in block-scoping transform
I previously tried an approach to scope bindings from var to scope but
it didn't catch all cases. This is evident in this bug:

https://phabricator.babeljs.io/T2892

Where even after transforming a const to a var we still get an error
that it's read-only.

This approach will go through and delete every existing let and const
binding and creates a new one with the kind "var"
2016-03-07 18:19:10 -08:00
..
2016-03-04 15:50:05 -05:00
2016-03-04 18:16:17 -05:00
2015-09-15 06:12:46 +01:00

babel-plugin-transform-es2015-block-scoping

Compile ES2015 block scoping (const and let) to ES5

Installation

$ npm install babel-plugin-transform-es2015-block-scoping

Usage

.babelrc

{
  "plugins": ["transform-es2015-block-scoping"]
}

Via CLI

$ babel --plugins transform-es2015-block-scoping script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["transform-es2015-block-scoping"]
});