Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a way to exclude cljsjs/react #27

Closed
mmavko opened this issue Apr 10, 2015 · 2 comments
Closed

Provide a way to exclude cljsjs/react #27

mmavko opened this issue Apr 10, 2015 · 2 comments

Comments

@mmavko
Copy link

mmavko commented Apr 10, 2015

I want to use my own React build. I added

:dependencies [[rum "0.2.6"]]
:exclusions [cljsjs/react]

to my project.clj but it can't compile Rum now giving this error:

clojure.lang.ExceptionInfo: No such namespace: cljsjs.react at line 1 file:/Users/petrus/.m2/repository/rum/rum/0.2.6/rum-0.2.6.jar!/rum.cljs {:tag :cljs/analysis-error, :file "file:/Users/petrus/.m2/repository/rum/rum/0.2.6/rum-0.2.6.jar!/rum.cljs", :line 1, :column 1}

Is there another way for doing this?

(We were talking about this in chat, but probably here is a better place for discussion).

@tonsky
Copy link
Owner

tonsky commented Apr 12, 2015

You need to specify React via :foreign-libs compiler option:

  :dependencies [
    [rum "0.2.6" :exclusions [cljsjs/react]]
  ]
...
:compiler {
          :foreign-libs [
            { :file "react/react-0.12.2.min.js"
              :provides ["cljsjs.react"]}
          ]
          :externs ["react/externs.js"]
}

I also have a test project for you here: https://github.com/tonsky/datascript-menu

Everything works in both :advanced and :none modes

@tonsky tonsky closed this as completed Apr 12, 2015
@mmavko
Copy link
Author

mmavko commented Apr 14, 2015

Yep, it works! Thanks.

But it requires spare pair of brackets for me:

  :dependencies [
    [rum "0.2.6" :exclusions [[cljsjs/react]]]
  ]

It's also worth noting that one can load React as cljsjs dependency directly, not as a foreign lib:

  :dependencies [[cljsjs/react-with-addons "0.12.2-8"]
                 [rum "0.2.6" :exclusions [[cljsjs/react]]]]

lein deps :tree command helps organizing dependencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants