Packaging Foreign Dependencies

This page explains how to package non-Closure compatible JavaScript
libraries for ClojureScript consumption. Before packaging a library make
sure that it has not already been packaged by someone else.
CLJSJS is a promising community driven effort
to provide a curated set of dependencies. To avoid duplication of effort
and dependency conflicts it’s recommended to contribute to a combined
effort such as CLJSJS.

When packaging a non-Closure compatible library for ClojureScript
consumption make sure to include the development version of the library,
the production version of the library, and an externs file. For example
if you were packaging React for consumption the directory structure
should probably look like the following:

Now users can simply add your JAR like any other dependency in their
pom.xml or project.clj and require the com.facebook.React
namespace in their ClojureScript source to import React. It’s important
to understand the namespace in this case is completely synthetic -
foreign dependencies are always loaded globally.

JARs may contain as many foreign libraries as you like just add more
entries to the :foreign-libs vector.

:file-min is completely optional but the above pattern is recommended
for the best experience for library consumers.