Skip to content

Namespace pollution

Paulus Esterhazy edited this page Dec 21, 2016 · 7 revisions

The Google Closure compiler assumes that it owns the global Javascript namespace. When using :optimizations simple or :optimizations :advanced, this can cause problems, as the names it chooses for JavaScript functions often collide with those used in JavaScript libraries.

For example, with advanced optimizations, Closure picks two-letter combinations like window.fb and window.dt, clobbering functions from popular frameworks. This results in hard-to-trace JavaScript errors. What's more, these problems can appear as the result of unrelated changes, which accidentally influence Closure's naming scheme.

For boot-cljs, the solution is to set the :output-wrapper true compiler option.

See the Google Closure FAQ item.

Clone this wiki locally