From 902cc160d3f8f405a35a8f16da227489366a3ad6 Mon Sep 17 00:00:00 2001 From: Ville Lautanala Date: Fri, 1 Jan 2021 16:04:32 +0200 Subject: [PATCH] Remove Harmony mode from README, recommend terser Harmony mode is not up-to-date in UglifyJS, and more likely to cause issues. Recommend ruby-terser as an alternative. --- README.md | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/README.md b/README.md index f1a6dd3..5503df0 100644 --- a/README.md +++ b/README.md @@ -3,25 +3,7 @@ Ruby wrapper for [UglifyJS](https://github.com/mishoo/UglifyJS2) JavaScript compressor. -UglifyJS currently is extensively tested with ES5, but also includes experimental ES6/ES2015+/Harmony support. - -More stable alternatives for working with ES6 code is to first transpile to ES5 with e.g. [babel-transpiler](https://github.com/babel/ruby-babel-transpiler) or using [Closure Compiler](https://github.com/documentcloud/closure-compiler) to directly minify ES6 code. - -## ES6 / ES2015+ / Harmony mode - -When using Uglifier with ES6 syntax without any options, an error will be -thrown. - -``` -Uglifier::Error: Unexpected token: punc ((). To use ES6 syntax, harmony mode must be enabled with Uglifier.new(:harmony => true). -``` - -The experimental ES6 syntax support can be enabled by passing `:harmony => true` -option to Uglifier. - -```ruby -Uglifier.compile(js, harmony: true) -``` +UglifyJS only works with ES5. If you need to compress ES6, [ruby-terser](https://github.com/ahorek/terser-ruby) is a better option. ### Rails