Makes sense to me. Of course I have not deep-dived into this stuff yet.

It seems to me that these levels should be a compile-time option which could be 
easily changed. Is that the case now?

Harbs

On Sep 22, 2015, at 9:37 AM, Josh Tynjala <joshtynj...@gmail.com> wrote:

> The Closure compiler has three compilation levels.
> 
> CompilationLevel.WHITESPACE_ONLY
> CompilationLevel.SIMPLE_OPTIMIZATIONS
> CompilationLevel.ADVANCED_OPTIMIZATIONS
> 
> Right now, JSClosureCompilerWrapper specifies the ADVANCED_OPTIMIZATIONS
> compilation level. This level changes the code the most, but it can also be
> the most, well, destructive.
> 
> Unfortunately, the files in js-release have never worked for one of my
> projects because my projects need to call out to external libraries. The
> Closure compiler supports passing in externs files to preserve the right
> API names for external libraries, of course. I don't actually know if
> FlexJS exposes the ability to pass in externs at this point in the
> compilation process (I know externc uses externs files, obviously).
> However, I'd rather not need to do that regardless. It's a pretty demanding
> requirement, in my opinion. I think it adds a barrier to entry, and if
> supported, it should be opt-in.
> 
> I tried creating a build that used SIMPLE_OPTIMIZATIONS instead. It worked
> a little bit better. It was able to call out to external libraries, but
> some things weren't clearly broken in the browser. Unfortunately, the
> browser console did not show any runtime errors, so it's hard to say what
> broke without some serious debugging. It seems that Closure compiler's
> optimizations are still somewhat destructive at the SIMPLE_OPTIMIZATIONS
> level.
> 
> When I created a build that used WHITESPACE_ONLY, everything worked as
> expected. I personally think that WHITESPACE_ONLY should be the default in
> JSClosureCompilerWrapper. This compilation level still minifies the code,
> which is what we care about the most for a release build. Most JS
> developers don't do more than basic minimization, as I've come to
> understand it. The more advanced stuff that the Closure compiler does is
> more out of the ordinary. Probably due to the potential for breaking
> things. I remember when I worked at Yahoo, the recommended best practice
> was to avoid renaming things during minification.
> 
> Can we change JSClosureCompilerWrapper to use WHITESPACE_ONLY instead?
> 
> - Josh

Reply via email to