Skip to content
Juho Teperi edited this page Jan 10, 2016 · 3 revisions

This page doesn't try to list all common problems but lists some which are specific to Boot-cljs or are caused by differences to other common tools, such as Cljsbuild.

Problems with Advanced optimized code and external JavaScript

Closure compiler emits JavaScript globals such as aE in advanced optimization mode. This is not problem when all code in the project is processed by Closure compiler (i.e. ClojureScript). When using Closure optimized code with some external JavaScript, like JS libraries from Cljsjs or some other code in page where the result is included (for example Wordpress), it is possible that the external script tries to use the same globals as Closure optimized code.

To fix this, it is possible to use :output-wrapper ClojureScript option to wrap the resulting code in a closure ((function(){...};)()) to avoid making the vars global. The default value for this option in ClojureScript compiler is false. Cljsbuild default value for the option is true.

https://github.com/clojure/clojurescript/wiki/Compiler-Options#output-wrapper

Clone this wiki locally