简体   繁体   中英

Are there any BundleTransformer JS minifiers that support ES6?

Are there any JS minifiers for BundleTransformer that support EcmaScript 6? I have tried installing:

  • BundleTransformer.Closure
  • BundleTransformer.YUI
  • BundleTransformer.UglifyJs

But neither seem to handle the string template syntax of ES6, such as:

`Hello ${world}`

Am I missing something, or is it time to upgrade to Node + X?

Tormod!

Suppose you have the following code:

var world = 123;
alert(`Hello ${world}`);

Only two minifiers from the Bundle Transformer can process it:

  1. MicrosoftAjaxJsMinifier from BundleTransformer.MicrosoftAjax . It just minify a ES6 code.
  2. ClosureLocalJsMinifier from BundleTransformer.Closure with the following configuration settings:

     <?xml version="1.0" encoding="utf-8"?> <configuration> … <bundleTransformer xmlns="http://tempuri.org/BundleTransformer.Configuration.xsd"> … <closure> <js> … <local closureCompilerApplicationPath="…" javaVirtualMachinePath="…" languageInput="EcmaScript6" languageOutput="EcmaScript3" /> … </js> </closure> … </bundleTransformer> … </configuration> 

The transpilation from ES6 to ES3 will be made, and then the ES3 code will be minified. In addition, to the languageOutput attribute can be set the following values: EcmaScript5 and EcmaScript5Strict .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM