1

I'm trying to install the Ant Design library via :npm-deps, so in my project.clj I have:

  :cljsbuild {:builds {:app
                       {:source-paths ["src" "env/dev/cljs"]
                        :compiler
                        {:main "metro-parks-cljs-components.dev"
                         :output-to "public/js/app.js"
                         :output-dir "public/js/out"
                         :asset-path   "js/out"
                         :source-map true
                         :optimizations :none
                         :install-deps true
                         :npm-deps {:react "^16.8.5"
                                    :react-dom "^16.8.5"
                                    :antd "^3.15.2"
                                    :moment "^2.24.0"}}
                         ...

And in my app code:

(ns metro-parks-cljs-components.event-finder
  (:require
    ...
    [reagent.core :as r]
    [moment]
    [antd :refer [DatePicker Pagination]]))

This compiles but on page load I get:

Error: Undefined nameToPath for module$home$ctamayo$workspace$metro_parks$wp_content$themes$metro_parks$metro_parks_cljs_components$node_modules$antd$es$affix base.js:1357:21
    visitNode http://localhost:3449/js/out/goog/base.js:1357
    visitNode http://localhost:3449/js/out/goog/base.js:1355
    visitNode http://localhost:3449/js/out/goog/base.js:1355
    visitNode http://localhost:3449/js/out/goog/base.js:1355
    writeScripts_ http://localhost:3449/js/out/goog/base.js:1369
    require http://localhost:3449/js/out/goog/base.js:706
    <anonymous> http://localhost:3449/index.html:80

Is this a known issue with npm-deps right now? Is there a workaround?

Note: I have looked into using shadow-cljs but I'm hesitant to migrate to a whole new build system due to time constraints.

3
  • Did you ever get an answer for this?... I'm having +1 moment. Thx! Commented Mar 14, 2020 at 8:23
  • 1
    @jbg no, I did end up using shadow-cljs. I'd recommend going that route if you need to interact with the NPM ecosystem at all. Commented Mar 21, 2020 at 4:47
  • Thank you for the reply! I ended up doing exactly that: switching to shadow-cljs. Commented Mar 22, 2020 at 6:07

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.