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.

4

0 回答 0