Skip to content

Commit

Permalink
document known issues with const (#1916)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlamsl committed May 11, 2017
1 parent 487ae8e commit 13e5e33
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion README.md
Expand Up @@ -11,7 +11,9 @@ There's also an
Chrome and probably Safari).

#### Note:
- `uglify-js` only supports ECMAScript 5 (ES5).
- `uglify-js` only supports ECMAScript 5 (ES5).
- Support for `const` is [present but incomplete](#support-for-const), and may not be
transformed properly.
- Those wishing to minify ES2015+ (ES6+) should use the `npm` package [**uglify-es**](https://github.com/mishoo/UglifyJS2/tree/harmony).

Install
Expand Down Expand Up @@ -975,3 +977,10 @@ The `source_map_options` (optional) can contain the following properties:
[codegen]: http://lisperator.net/uglifyjs/codegen
[compressor]: http://lisperator.net/uglifyjs/compress
[parser]: http://lisperator.net/uglifyjs/parser

#### Support for `const`

`const` in `uglify-js@2.x` has function scope and as such behaves much like
`var` - unlike `const` in ES2015 (ES6) which has block scope. It is recommended
to avoid using `const` for this reason as it will have undefined behavior when
run on an ES2015 compatible browser.

0 comments on commit 13e5e33

Please sign in to comment.