Fork me on GitHub

0.2.13-SNAPSHOT seems to work for me with

org.clojure/clojurescript {:mvn/version "1.10.844"}


I am having trouble converting my figwheel-main project to use :auto-bundle :webpack and npm libraries. I have everything working with a normal development build with :optimizations set to :none When I attempt to compile with :optimizations set to :simple webpack fails and dumps out a lot of errors that look like this

WARNING in ./resources/public/js/compiled/out/main.js 2200:14094-14116
Module not found: Error: Can't resolve './locale' in '/home/user/work/web-ui/resources/public/js/compiled/out'

1 warning has detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.

ERROR in ./resources/public/js/compiled/out/main.js 207:82-98
Module not found: Error: Can't resolve 'React' in '/home/user/work/web-ui/resources/public/js/compiled/out'

ERROR in ./resources/public/js/compiled/out/main.js 207:99-118
Module not found: Error: Can't resolve 'ReactDOM' in '/home/user/work/web-ui/resources/public/js/compiled/out'
Some of the modules it is trying to find (like react), should be reachable through my node_modules. The error about ./locale not being found I suspect comes from my usage of moment-js which I'm still pulling from cljsjs (I do not want to move everything to NPM yet if I can avoid it). Others that it cannot reach I am pulling in through the :foreign-libs option in my figwheel config. The libraries in foreign libs I am loading in through <script> tags in my inital HTML, so I feel like webpack wouldn't need to do anything with those. Has anyone encountered this problem yet? Looking for advice. Thank you.


I haven’t seen anything like this, but what does you config look like?


Since posting this I've gotten rid of some of the errors. Pulling moment and other libraries from npm has helped. The errors about React and ReactDOM are still there. The externs and foreign libs are just some private js libraries. They seem to be working fine, at least with the non-optimized build.

^{:auto-bundle :webpack}
{:main            pm2-ui.core
 :optimizations   :simple
 :aot-cache       false
 :clean-outputs   true
 :output-dir      "./resources/public/js/compiled/out"
 :asset-path      "/ui/js/compiled/out"
 :closure-defines {goog.DEBUG false}
 :pseudo-names    false
 :pretty-print    false
 :infer-externs   false
 :externs [...]
 :foreign-libs [...]}
My leiningen dependencies looks like this
[org.clojure/clojure "1.10.0"]
[org.clojure/clojurescript "1.10.773"]
[reagent "1.0.0" :exclusions [cljsjs/react cljsjs/react-dom cljsjs/react-dom-server]]
[re-frame "1.2.0"]
[ "v0.2.0"]
[ "0.5.5"]
[ "0.1.0"]
[devcards "0.2.7" :exclusions [cljsjs/react cljsjs/react-dom cljsjs/create-react-class]]
[cljsjs/react-virtualized "9.18.5-1" :exclusions [cljsjs/react cljsjs/react-dom cljsjs/create-react-class]]
[cljsjs/react-number-format "3.4.2-0" :exclusions [cljsjs/react cljsjs/react-dom cljsjs/create-react-class]]
[com.bhauman/figwheel-main "0.2.12"]


I've also go these dependencies listed in my package.json

"create-react-class": "15.6.3",
"moment": "2.22.0",
"react": "16.13.0",
"react-beautiful-dnd": "13.1.0",
"react-datepicker": "1.4.1",
"react-dom": "16.13.0",
"react-select": "1.2.1"