[Pkg-javascript-commits] [uglifyjs] 12/50: document known issues with `const` (#1916)

Jonas Smedegaard dr at jones.dk
Thu Aug 17 23:06:44 UTC 2017


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository uglifyjs.

commit 13e5e334488bd4be89733e2fdde5fc866107c2a4
Author: Alex Lam S.L <alexlamsl at gmail.com>
Date:   Fri May 12 03:36:54 2017 +0800

    document known issues with `const` (#1916)
---
 README.md | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 33a1c68..1d64fcb 100644
--- a/README.md
+++ b/README.md
@@ -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
@@ -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 at 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.

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/uglifyjs.git



More information about the Pkg-javascript-commits mailing list