[英]Is it possible to annotate JavaScript for the Closure Compiler adding @language ECMASCRIPT5?
I need to minificate some code using Google Compiler compiler.jar as part of a build process. 在构建过程中,我需要使用Google Compiler Compiler.jar简化一些代码。
I have notice that by default the compiler is set to ES3 when I need instead setting the language to ES5. 我注意到默认情况下,当我需要将语言设置为ES5时,编译器设置为ES3。
At the moment I am trying to annotate my source code in order to fore ES5 using the following scripts. 目前,我正在尝试注释我的源代码,以便使用以下脚本发布ES5。
Unfortunately @language
is being ignored. 不幸的是@language
被忽略。
My question: 我的问题:
@language ECMASCRIPT5
in code annotation directily in JS source code? 是否可以在JS源代码中直接在代码注释中强制使用@language ECMASCRIPT5
ECMASCRIPT5? // ==ClosureCompiler==
// @compilation_level SIMPLE_OPTIMIZATIONS
// @language ECMASCRIPT5
// ==/ClosureCompiler==
define([
'dojo/_base/declare',
'dojo/topic'
], function (declare, topic) {
'use strict';
return declare('Message', null, {
_test: 'default',
get test() {
return this._test;
},
set test(value) {
this._test = value;
},
constructor: function (options) {
}
});
});
No language is not determined by annotations - but by compiler options (flags). 语言不是由注释决定的,而是由编译器选项(标志)决定的。
java -jar compiler.jar -O=SIMPLE --language_in=ECMASCRIPT5
I realize that the web service uses special annotations - but they are part of the special comment block at the top of the file. 我意识到Web服务使用特殊注释-但是它们是文件顶部特殊注释块的一部分。 This is a special case and not used elsewhere. 这是特例,在其他地方未使用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.