Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Playframework 谷歌闭包编译器对我的js文件做了一些奇怪的事情_Playframework_Sbt_Google Closure Compiler_Playframework 2.2 - Fatal编程技术网

Playframework 谷歌闭包编译器对我的js文件做了一些奇怪的事情

Playframework 谷歌闭包编译器对我的js文件做了一些奇怪的事情,playframework,sbt,google-closure-compiler,playframework-2.2,Playframework,Sbt,Google Closure Compiler,Playframework 2.2,我已经编写了一个小js脚本,它将提供 我的其他脚本的预订var 脚本的小摘录: var booking={ venue: null, baseUrl: "http://fancy.url.com", align: "right", top: "200px", image: null, id: 0, height: null, width: "162px", action: "Boka", text: "Hello!"

我已经编写了一个小js脚本,它将提供 我的其他脚本的预订var

脚本的小摘录:

var booking={
    venue: null,
    baseUrl: "http://fancy.url.com",
    align: "right",
    top: "200px",
    image: null,
    id: 0,
    height: null,
    width: "162px",
    action: "Boka",
    text: "Hello!",
    openStartpage: false,
    buttonColor: "green",

    // Variables
    imageUrl: "/assets/images/button/",    

    sayHelloToConsole: function (){
        console.log(hello);
    }
};
booking.init();
我使用以下命令异步加载脚本:

<script type="text/javascript">
var _booking = _booking || {};
_booking["venue"] = "venue";
_booking["id"] = 3460483;
_booking["baseUrl"] = "http://localhost:9000";
_booking["buttonColor"] = "blue";

(function() {
function asyncLoad(){
var s = document.createElement('script');
s.type = 'text/javascript';
s.async = true;
s.src = 'http://localhost:9000/assets/javascripts/booking.min.js?v=1.0';
var x = document.getElementsByTagName('script')[0];
x.parentNode.insertBefore(s, x);
}
if (window.attachEvent)
window.attachEvent('onload', asyncLoad);
else
window.addEventListener('load', asyncLoad, false);
})();
</script>

var|u booking=|u booking |{};
_预订[“场馆”]=“场馆”;
_预订[“id”]=3460483;
_预订[“基本URL”]=“http://localhost:9000";
_预订[“按钮颜色”]=“蓝色”;
(功能(){
函数asyncLoad(){
var s=document.createElement('script');
s、 类型='text/javascript';
s、 异步=真;
s、 src='1〕http://localhost:9000/assets/javascripts/booking.min.js?v=1.0';
var x=document.getElementsByTagName('script')[0];
x、 parentNode.insertBefore(s,x);
}
如果(窗口附件)
attachEvent('onload',asyncLoad);
其他的
addEventListener('load',asyncLoad,false);
})();
我让googleClosureComiler缩小脚本,这样我就可以在我的play应用程序中访问该文件。我在build.sbt文件中没有提供任何编译器选项

然后我尝试使用编译器放在我的公用文件夹中的缩小文件,但是 编译器对缩小文件中的变量做了一些非常奇怪的事情。 例如,我的变量名为booking$$module$booking,而不是booking。那么什么时候 我想访问预订我得到一个错误,预订未定义。 预订$$module$预订已定义并开始工作

为什么编译器将booking重命名为booking$$module$booking?我如何预防
这不会发生吗?

听起来构建脚本正在使用
高级优化
,您可能需要
简单优化
。它似乎还使用了
debug
标志,这会导致在展平属性时属性重命名使用$symbols(以便可以追溯错误)。你应该关掉这个。哦,谢谢!你知道怎么做吗?或者你能给我指出正确的方向吗?不是游戏框架。我还没有用过它。这也可能是标准化模块的CommonJS/RequireJS支持选项。不确定。是的,我没想到那个。