似乎找不到当前的信息或我的问题的有效解决方案。我正在尝试将/src目录中的所有脚本编译为一个独立的JavaScript库(而不是闭包应用程序)。尽管我设置了标志--output_mode=compiled
,但编译的输出仍然具有
var COMPILED=!0
下面是我是如何编译的:
1-将我所有的.js文件合并到./tmp/concat.js中的单个文件中2-使用以下命令通过编译器运行concat.js
./lib/closure/bin/build/closurebuilder.py \
--root=/usr/local/google-closure/closure-library/ \
--root=./tmp \
--namespace=BB.go \
--output_mode=compiled \
--compiler_jar=/usr/local/google-closure/compiler.jar \
--compiler_flags="--compilation_level=SIMPLE_OPTIMIZATIONS" \
--compiler_flags="--create_source_map=bb.js.map" \
--compiler_flags="--warning_level=VERBOSE" \
--compiler_flags="--language_in=ECMASCRIPT5" \
> bb.min.js
输出是具有上述问题的bb.min.js
。
快速说明
如果我在ADVANCED_OPTIMIZATIONS
模式下编译它,那么我会得到预期的输出(减去所有被重命名的公共接口,这是我不想要的,我也不想把它们全部导出)。我想要做的是在SIMPLE_OPTIMIZATIONS
模式下编译,并且只使用空格(这样我就可以将这个库作为一个非缩小/非模糊的库来提供)。
发布于 2014-04-18 04:00:38
我很确定--output_mode=compiled
应该是--output_mode="compiled"
下面是我的工作原理:
python Z:\scripts\closure\closure\bin\calcdeps.py^
--path=Z:\scripts\closure\^
--output_mode="compiled"^
--compiler_jar=Z:\scripts\closure\other\compiler.jar^
--compiler_flag=--compilation_level=ADVANCED_OPTIMIZATIONS^
--compiler_flag=--use_types_for_optimization^
--compiler_flag=--warning_level=VERBOSE^
--input=Z:\scripts\closure\other\soyutils_usegoog.js^
--input=Z:\scripts\closure\closure\goog\deps.js^
--input=utils.js^
--input=main.js^
--input=templates.soy.js^
--output_file=main.min.js
请注意,您需要修改它以匹配您的路径/文件,而我的路径是针对windows环境的,因此请将^
替换为\
,并将路径的反斜杠替换为正斜杠。
https://stackoverflow.com/questions/23142048
复制相似问题