jmckitrick
jmckitrick

Reputation: 171

Why would this clojurescript build profile work locally but not on Heroku?

Here is the prod configuration used locally and in the uberjar for Heroku deployment:

{:source-paths ["src/cljs"]
                :compiler {:output-to "resources/public/js/main.js"
                           :optimizations :advanced
                           :cache-analysis true
                           :static-fns true
                           :elide-asserts true
                           :pretty-print false
                           :externs ["jquery/jquery-externs.js" "public/vendor/js/bootstrap.min.js"]
                           :preamble ["jquery/jquery-2.1.1.min.js"
                                      "public/vendor/js/bootstrap.min.js"
                                      "reagent/react.js"]}}

But with the externs directive enabled for Heroku deployment, I get this error:

Jan 14, 2015 12:24:24 PM com.google.javascript.jscomp.LoggerErrorManager println
       SEVERE: ERROR - Duplicate extern input: /tmp/build_a17563dbd2ef7be695204764be886d91/resources/jquery/jquery-externs.js

       Jan 14, 2015 12:24:24 PM com.google.javascript.jscomp.LoggerErrorManager println
       SEVERE: ERROR - Duplicate extern input: /tmp/build_a17563dbd2ef7be695204764be886d91/resources/public/vendor/js/bootstrap.min.js

       Jan 14, 2015 12:24:24 PM com.google.javascript.jscomp.LoggerErrorManager printSummary
       WARNING: 2 error(s), 0 warning(s)
       ERROR: JSC_DUPLICATE_EXTERN_INPUT. Duplicate extern input: /tmp/build_a17563dbd2ef7be695204764be886d91/resources/jquery/jquery-externs.js at (unknown source) line (unknown line) : (unknown column)
       ERROR: JSC_DUPLICATE_EXTERN_INPUT. Duplicate extern input: /tmp/build_a17563dbd2ef7be695204764be886d91/resources/public/vendor/js/bootstrap.min.js at (unknown source) line (unknown line) : (unknown column)
       Successfully compiled "resources/public/js/main.js" in 38.526 seconds.

Any suggestions?

Upvotes: 5

Views: 567

Answers (2)

Valentin Waeselynck
Valentin Waeselynck

Reputation: 6051

I had a similar error, the problem was solved by adding some :exclusions.

In my case, I was using React with Addons and Reagent (which depends on React), hence the collision.

Wrong:

:dependencies [[cljsjs/react-with-addons "0.13.3-0"]
               [reagent "0.5.0"]

Right:

:dependencies [[cljsjs/react-with-addons "0.13.3-0"]
               [reagent "0.5.0" :exclusions [cljsjs/react]]

Upvotes: 1

David L
David L

Reputation: 136

I don't believe this is an issue in lein 2.5.1. In any case, try :externs ^:replace ["jquery/jquery-externs.js" "public/vendor/js/bootstrap.min.js"] to mitigate.

Upvotes: 2

Related Questions