Atlassian uses cookies to improve your browsing experience, perform analytics and research, and conduct advertising. Accept all cookies to indicate that you agree to our use of cookies on your device. Atlassian cookies and tracking notice, (opens new window)
Support Override of Custom Closure Defines w/ :none/:whitespace
Key details
Description
When creating "uncompiled" builds (:none, :whitespace) it is not possible to override a custom Closure @define by passing a different value to the compiler option :closure-defines.
Closure provides CLOSURE_UNCOMPILED_DEFINES and CLOSURE_DEFINES [1] which can be set before loading any other code. Overriding defines this way only works for Defines with done with goog.define. Using goog.define however introduces other problems: 1) The name passed to goog/define must match the name in compiled JS. E.g. (goog/define "hello_world.core.DBG" true). 2) This produces no var in CLJS which causes an undeclared var warning if the defined var is used. 3) There is nothing to be annotated causing ERROR: JSC_INVALID_MISSING_DEFINE_ANNOTATION.
Getting the CLOSURE_UNCOMPILED_DEFINES into the build is straightforward, just not sure how to deal with those other complexities.
When creating "uncompiled" builds (:none, :whitespace) it is not possible to override a custom Closure @define by passing a different value to the compiler option
:closure-defines.Closure provides
CLOSURE_UNCOMPILED_DEFINESandCLOSURE_DEFINES[1] which can be set before loading any other code.Overriding defines this way only works for Defines with done with
goog.define.Using
goog.definehowever introduces other problems:1) The name passed to
goog/definemust match the name in compiled JS. E.g.(goog/define "hello_world.core.DBG" true).2) This produces no var in CLJS which causes an undeclared var warning if the defined var is used.
3) There is nothing to be annotated causing
ERROR: JSC_INVALID_MISSING_DEFINE_ANNOTATION.Getting the
CLOSURE_UNCOMPILED_DEFINESinto the build is straightforward, just not sure how to deal with those other complexities.[1] http://google.github.io/closure-library/api/source/closure/goog/base.js.src.html#l147