aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-03-01 04:12:10 +0800
committerGitHub <noreply@github.com>2017-03-01 04:12:10 +0800
commitf5cbe19b753bf84f8b11f96e2c91a8ca49525dba (patch)
tree75569231e92b9d72baab77ed81961b415e13e1e7 /README.md
parentb34fa11a13221b7ad26ea48f18fcf2f5903c94c1 (diff)
downloadtracifyjs-f5cbe19b753bf84f8b11f96e2c91a8ca49525dba.tar.gz
tracifyjs-f5cbe19b753bf84f8b11f96e2c91a8ca49525dba.zip
invert `reduce_vars` tracking flag (#1519)
Modules like webpack and grunt-contrib-uglify still uses `ast.transform(compressor)` before `Compressor.compress(ast)` was introduced. Workaround this compatibility issue by deactivating `reduce_vars` in such case. Also fix use case with omitted `options` when calling `Compressor()`. fixes #1516
Diffstat (limited to 'README.md')
-rw-r--r--README.md4
1 files changed, 2 insertions, 2 deletions
diff --git a/README.md b/README.md
index 260a685d..79064d79 100644
--- a/README.md
+++ b/README.md
@@ -621,7 +621,7 @@ function uglify(ast, options, mangle) {
// Compression
uAST.figure_out_scope();
- uAST = uAST.transform(UglifyJS.Compressor(options));
+ uAST = UglifyJS.Compressor(options).compress(uAST);
// Mangling (optional)
if (mangle) {
@@ -865,7 +865,7 @@ toplevel.figure_out_scope()
Like this:
```javascript
var compressor = UglifyJS.Compressor(options);
-var compressed_ast = toplevel.transform(compressor);
+var compressed_ast = compressor.compress(toplevel);
```
The `options` can be missing. Available options are discussed above in