fix: publishing app in prod mode

Also fix watch-publishing-frontend which had stopped working awhile back
with shadow-cljs update
This commit is contained in:
Gabriel Horner
2025-08-01 17:56:39 -04:00
parent f7e32108f2
commit 182a51a85e
4 changed files with 10 additions and 8 deletions

View File

@@ -8,7 +8,7 @@
(def ^:api js-files
"js files from publishing release build"
(->> ["main.js" "code-editor.js" "excalidraw.js" "tldraw.js" "db-worker.js"]
(->> ["main.js" "code-editor.js" "excalidraw.js" "tldraw.js"]
;; Add source maps for all js files as it doesn't affect initial load time
(mapcat #(vector % (str % ".map")))
vec))

View File

@@ -124,6 +124,7 @@ necessary db filtering"
[:script {:src "static/js/react.production.min.js"}]
[:script {:src "static/js/react-dom.production.min.js"}]
[:script {:src "static/js/ui.js"}]
[:script {:src "static/js/main-bundle.js"}]
[:script {:src "static/js/main.js"}]
;; Deferring scripts above results in errors
[:script {:defer true :src "static/js/interact.min.js"}]

View File

@@ -87,7 +87,7 @@
(defn watch-publishing-frontend
[& _args]
(shell "clojure -M:cljs watch publishing"))
(shell "npx shadow-cljs watch publishing"))
(defn watch-publishing-backend
"Builds publishing backend once watch-publishing-frontend has built initial frontend"

View File

@@ -187,17 +187,18 @@
:publishing {:target :browser
:module-loader true
:js-options {;; handle `require(xxx.css)`
:js-options {:js-provider :external
:external-index "target/main.js"
:external-index-format :esm
:entry-keys ["module" "browser" "main"]
:export-conditions ["module" "import", "browser" "require" "default"]
:ignore-asset-requires true
:resolve {"react" {:target :global
:global "React"}
"react-dom" {:target :global
:global "ReactDOM"}}}
:modules {:shared
{:entries []}
:main
{:init-fn frontend.publishing/init
:depends-on #{:shared}}
:modules {:main
{:init-fn frontend.publishing/init}
:code-editor
{:entries [frontend.extensions.code]
:depends-on #{:main}}