我正在使用这叉的咕噜-闭包编译器任务来构建多个文件与闭包编译器。
我设置了以下编译器标志:
--module_output_path_prefix .\ --js lib\test\mod-c.js --module test_mod__c:1 --js lib\test\mod-d.js --module test_mod__d:1 --js lib\test\mod-b.js --module test_mod__b:1:test_mod__c,test_mod__d --js lib\test\mod-a.js --module test_mod__a:1:test_mod__b,test_mod__d --compilation_level "ADVANCED_OPTIMIZATIONS" --language_in "ECMASCRIPT5_STRICT"每当我运行这个程序时,我都会得到以下错误:
java.lang.IllegalArgumentException: expected one element but was: <test_mod__c, test_mod__d>
at com.google.common.collect.Iterators.getOnlyElement(Iterators.java:317)
at com.google.common.collect.Iterables.getOnlyElement(Iterables.java:289)
at com.google.javascript.jscomp.JSModuleGraph.getRootModule(JSModuleGraph.java:150)
at com.google.javascript.jscomp.AnalyzePrototypeProperties.<init>(AnalyzePrototypeProperties.java:122)
at com.google.javascript.jscomp.CrossModuleMethodMotion.<init>(CrossModuleMethodMotion.java:79)
at com.google.javascript.jscomp.DefaultPassConfig$97.create(DefaultPassConfig.java:2170)
at com.google.javascript.jscomp.PhaseOptimizer$NamedPass.process(PhaseOptimizer.java:285)
at com.google.javascript.jscomp.PhaseOptimizer$Loop.process(PhaseOptimizer.java:458)
at com.google.javascript.jscomp.PhaseOptimizer.process(PhaseOptimizer.java:217)
at com.google.javascript.jscomp.Compiler.optimize(Compiler.java:1901)
at com.google.javascript.jscomp.Compiler.compileInternal(Compiler.java:681)
at com.google.javascript.jscomp.Compiler.access$000(Compiler.java:89)
at com.google.javascript.jscomp.Compiler$2.call(Compiler.java:632)
at com.google.javascript.jscomp.Compiler$2.call(Compiler.java:629)
at com.google.javascript.jscomp.CompilerExecutor$2.call(CompilerExecutor.java:93)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)根据我能找到的一些消息来源,这通常是由一个无效的依赖树引起的,但是我不明白为什么它是错误的。
发布于 2016-01-26 22:46:02
输出模块必须描述一棵树。这个要求意味着一个单一的基本模块,所有其他模块都会从这个模块中下降。基本模块是不依赖于其他模块的模块。
您的标志列出了2个基本模块:
--module test_mod__c:1--module test_mod__d:1这些是基本模块,因为它们不依赖于其他模块。从你的评论,我想你可能是倒叙树。基于您关于a是入口点的评论,我相信您想要的树如下所示:
test_mod__a
└─ test_mod__b
| ├─ test_mod__c
└─ └─ test_mod__d下面是描述这棵树的标志:
--module_output_path_prefix .\
--js lib\test\mod-a.js --module test_mod__a:1
--js lib\test\mod-b.js --module test_mod__b:1:test_mod__a
--js lib\test\mod-c.js --module test_mod__c:1:test_mod__b
--js lib\test\mod-d.js --module test_mod__d:1:test_mod__a,test_mod__b此外,您可能需要使用编译器的官方npm版本 -它现在包括一个咕噜插件,并支持--module标志。
免责声明:我管理npm的闭包编译器的发布,并且是插件作者。
https://stackoverflow.com/questions/35012421
复制相似问题