问题
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