Closed jaimesangcap closed 2 years ago
Hi @jaimesangcap :wave:
It looks to me like you are running into this behavior by specifying the :bundle-cmd
template in the ClojureScript configuration instead of the Figwheel configuration. If this is the case, you shouldn't do that. My understanding is that Figwheel doesn't run the bundler, it just takes care of passing a sensible :bundle-cmd
to the ClojureScript compiler. There are many ways to control the bundler command, so it can be a bit confusing! Could you please confirm that you are specifying the template in figwheel options only (e.g.: metadata on the compiler options)? If you could post more details on your configuration or a minimal example that would be helpful (thanks for posting the key/value, but it is necessary to know where that is being placed).
Hi @timothypratley , thanks for your reply. I've tried putting it in metadata.
^{:ring-server-options {:port 3450}
:watch-dirs ["src" "test"]
:css-dirs ["resources/public/css"]
:open-url false
:clean-outputs true
:auto-testing true
:bundle-cmd {:default ["npx" "webpack" "--mode=production" "--entry" :output-to
"--output-path" :final-output-dir
"--output-filename" :final-output-filename]}}
{:main dnyarri.core
:optimizations :none
:target :bundle
:aot-cache false
:cache-analysis false
:parallel-build true
:output-to "resources/public/js/compiled/app.js"
:output-dir "resources/public/js/compiled"
:asset-path "/js/compiled"
:source-map-timestamp true
:infer-externs true
:language-in :es-next
:preloads [devtools.preload
day8.re-frame-10x.preload]
:foreign-libs [{:file "src"
:module-type :es6}
{:file "node_modules/@sentry/tracing/build/bundle.tracing.min.js"
:provides ["sentry.with.tracing"]}]}
But figwheel-main said it's not a valid option
(fw/start "dev")
Execution error (ExceptionInfo) at figwheel.main.schema.core/validate-config! (core.clj:104).
Configuration error in build options meta data: dev.cljs.edn
-- Unknown map key ----------------
{:ring-server-options ...,
:watch-dirs ...,
:css-dirs ...,
:open-url ...,
:clean-outputs ...,
:auto-testing ...,
:bundle-cmd ...}
^^^^^^^^^^^
should be one of
:ring-stack, :client-log-level, :post-build-hooks, :validate-config, :ring-handler, :bundle-once, :clean-outputs, :repl-eval-timeout, :pprint-config, :log-level, :cljsjs-resources, :ring-server-options, :auto-bundle, :broadcast, :log-file, :bundle-freq, :reload-dependents, :mode, :helpful-classpaths, :connect-url, :extra-main-files, :inspect-node, :launch-js, :launch-node, :react-native:react-native[0m, :auto-testing, :open-url-wait-ms, :watch-dirs, :react-native-auto-refresh, :pre-build-hooks, :ansi-color-output, :rebel-readline, :ssl-valid-hosts, :ring-server, :broadcast-reload, :figwheel-core, :client-print-to, :final-output-to, :cljs-devtools, :open-file-command, :build-inputs, :wait-time-ms, :validate-cli, :ring-stack-options, :target-dir, :hot-reload-cljs, :npm, :node-command, :load-warninged-code, :log-syntax-error-style, :reload-clj-files, :css-dirs, :open-url, :use-ssl
-------------------------
Detected 1 error
Ah right, I understand now. Thank you for clarifying. I'll respond further on the PR.
Hi! Thank you for building this awesome tool! We just happily migrated our tooling to figwheel-main. However on our second project, we are having weird issue. When running
lein fig -- -b dev -r
(:auto-bundle :webpack or passing :target :bundle + :bundle-cmd explicitly), the app compiles fine the first time, but throws error when it detect changes and tries to recompile.Here is the error:
After some debugging, it seems like the
cljs.closure/build
picks upoptions
from thecompiler-env
here, which will then run the bundle-cmd here.This will cause an error since the value of
:bundle-cmd
is a templateProposed solution
Since figwheel already handles running the :bundle-cmd, it's unnecessary to pass that option again to cljs compiler to re-run the command. I created the PR https://github.com/bhauman/figwheel-main/pull/316
Or alternatively, fill-in the bundle-cmd template with actual value.