简体   繁体   English

是否有支持ES6的BundleTransformer JS minifiers?

[英]Are there any BundleTransformer JS minifiers that support ES6?

Are there any JS minifiers for BundleTransformer that support EcmaScript 6? BundleTransformer中是否有支持EcmaScript 6的JS minifiers? I have tried installing: 我试过安装:

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

But neither seem to handle the string template syntax of ES6, such as: 但似乎都没有处理ES6的字符串模板语法,例如:

`Hello ${world}`

Am I missing something, or is it time to upgrade to Node + X? 我错过了什么,或者是时候升级到Node + X了吗?

Tormod! Tormod!

Suppose you have the following code: 假设您有以下代码:

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

Only two minifiers from the Bundle Transformer can process it: Bundle Transformer中只有两个缩小器可以处理它:

  1. MicrosoftAjaxJsMinifier from BundleTransformer.MicrosoftAjax . 来自BundleTransformer.MicrosoftAjax的 MicrosoftAjaxJsMinifier It just minify a ES6 code. 它只是缩小了ES6代码。
  2. ClosureLocalJsMinifier from BundleTransformer.Closure with the following configuration settings: ClosureLocalJsMinifierBundleTransformer.Closure具有以下配置设置:

     <?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. 将进行从ES6到ES3的转换,然后将缩小ES3代码。 In addition, to the languageOutput attribute can be set the following values: EcmaScript5 and EcmaScript5Strict . 另外,对languageOutput属性可以设置以下值: EcmaScript5EcmaScript5Strict

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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