Using Three.js as Closure library?

核能气质少年 提交于 2019-12-24 11:22:31

问题


Looking at Three.js's build script, I see they use Google Closure compiler. I am having a small script utilizing Three.js. Can I use Google Closure to compile the script with Three.js as a library (instead of having Three.min.js preambled or included in an HTML tag) so the final output javascript is much smaller.

I'm asking this because I don't see any goog.provide in Three.js source.


回答1:


It looks like the build command does not specify a compilation level. That means it is using the default SIMPLE_OPTIMIZATIONS.

If that is indeed true, then no, you probably cannot include the source as a library as it is not compatible with ADVANCED_OPTIMIZATIONS.




回答2:


One way to do this is to prepend the three.js script to the compiler output using whatever shell or build system you are using.



来源:https://stackoverflow.com/questions/27905626/using-three-js-as-closure-library

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!