我需要在Closure编译器上设置language_in选项,以防止IE8解析错误:
I need to set the language_in option on the Closure compiler to prevent the IE8 parse error:
ERROR-解析错误. IE8(及更低版本)将错误地解析数组和对象文字中的尾部逗号.如果您要定位较新的JS版本,请设置相应的language_in选项.
ERROR - Parse error. IE8 (and below) will parse trailing commas in array and object literals incorrectly. If you are targeting newer versions of JS, set the appropriate language_in option.
我确实在闭包组中找到了与此相关的帖子,但是,该选项直接在Java编译器上设置,而不是通过构建脚本之一设置.我需要能够在构建脚本上进行设置.
I did find a post in the closure group relating to this, however, the option is set directly on the java compiler, rather than through one of the build scripts. I need to be able to set it on a build script.
我正在查看Closure/bin/build/中的脚本,那里有几个.我尝试将选项添加到闭包生成器,但失败了.
I'm looking at the scripts in closure/bin/build/ and there are several there. I tried adding the option to closure builder, but it failed.
有人可以指导我如何正确设置此选项吗?
Can someone direct me about how to set this option correctly?
谢谢.
推荐答案运行关闭带有--help标志的编译器应用程序,以查看每个标志的描述.
Run the Closure Compiler Application with the --help flag to see a description of each flag.
java -jar compiler.jar --helpCommandLineRunner 定义--language_in的允许值集:
--language_in 设置输入源符合的语言规范. 选项:ECMASCRIPT3,ECMASCRIPT5,ECMASCRIPT5_STRICT, ECMASCRIPT6_TYPED(实验性),ECMASCRIPT_2015,ECMASCRIPT_2016, ECMASCRIPT_2017,ECMASCRIPT_NEXT
--language_in Sets what language spec that input sources conform. Options: ECMASCRIPT3, ECMASCRIPT5, ECMASCRIPT5_STRICT, ECMASCRIPT6_TYPED (experimental), ECMASCRIPT_2015, ECMASCRIPT_2016, ECMASCRIPT_2017, ECMASCRIPT_NEXT
LanguageMode枚举具有关于这些值的更多详细信息.
The LanguageMode enum has a bit more detail about these values.
使用 Closure Builder ,--language_in标志将以的参数 --compiler_flags如下:
Using Closure Builder, the --language_in flag would be passed as an argument to --compiler_flags as in:
--compiler_flags="--language_in=ECMASCRIPT5"更多推荐
如何为Closure编译器设置language
发布评论