This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-04-09
Channels
- # announcements (26)
- # asami (1)
- # babashka (7)
- # beginners (51)
- # calva (1)
- # cider (18)
- # clj-kondo (6)
- # clj-together (1)
- # cljsrn (4)
- # clojure (78)
- # clojure-australia (3)
- # clojure-europe (25)
- # clojure-losangeles (1)
- # clojure-nl (2)
- # clojure-serbia (4)
- # clojure-spec (23)
- # clojure-uk (19)
- # clojurescript (23)
- # community-development (13)
- # deps-new (1)
- # emacs (24)
- # figwheel-main (5)
- # fulcro (61)
- # graalvm (1)
- # honeysql (11)
- # jobs (1)
- # lsp (7)
- # malli (4)
- # meander (6)
- # membrane (3)
- # off-topic (10)
- # polylith (13)
- # quil (7)
- # re-frame (54)
- # reagent (18)
- # remote-jobs (2)
- # shadow-cljs (81)
- # sql (16)
- # tools-deps (12)
- # xtdb (10)
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"]
[day8.re-frame/http-fx "v0.2.0"]
[day8.re-frame/tracing-stubs "0.5.5"]
[day8.re-frame/async-flow-fx "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"