Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 219
jmckitrick Avatar asked Oct 19 '22 19:10

jmckitrick


2 Answers

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.

like image 188
David L Avatar answered Oct 22 '22 23:10

David L


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]]
like image 35
Valentin Waeselynck Avatar answered Oct 22 '22 23:10

Valentin Waeselynck