我正在尝试通过:npm-deps
安装Ant Design库,因此在我的project.clj中,我有:
: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"}}
...
在我的应用代码中:
(ns metro-parks-cljs-components.event-finder
(:require
...
[reagent.core :as r]
[moment]
[antd :refer [DatePicker Pagination]]))
这可以编译,但是在页面加载时我得到:
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
这是npm-deps
的已知问题吗?有解决方法吗?
注意:我已经考虑使用shadow-cljs,但是由于时间限制,我不愿意迁移到全新的构建系统中。