Is this a recoverable issue? I am trying to use https://gosling-lang.org/ again, and failing again:
[:app] Compiling ...
[:app] Build failure:
Closure compilation failed with 1 errors
--- node_modules/gosling_DOT_js/dist/gosling.js:10236
Dynamic import expressions cannot be transpiled.
If you search for "Dynamic import expressions cannot be transpiled." in this channel, there will be quite a few discussions in the results.
Hm, I think I only found this one. (*nevermind I forgot to search in shadow-cljs) Am I understanding this correctly to mean that it's categorically not possible to use stuff that uses dynamic imports for browser stuff? The comment seems to imply its not possible in the browser at all, which is weird to me because this is most definitely a browser lib https://clojurians.slack.com/archives/C03S1L9DN/p1689534348771779?thread_ts=1689532330.872299&cid=C03S1L9DN
It might be that a wrong JS file is used during compilation - one that's not suitable for browsers.
It also seems that I misunderstood the comment. I will have to do some reading first to understand what I am asking in the first place, otherwise this thread will turn out a protocol of my thought process again
Or it could be that it's targeted at webpack or some webpack plugin that rewrites dynamic requires into something else.
Yeah I'm seeing omens this is gonna end with trying it with webpack again
What on earth is this trying to tell me?
npx webpack --entry ./frontend/target/index.js --output-path ./frontend/resources/public/js --output-filename libs.js
Module not found: Error: Package path . is not exported from package /.../node_modules/gosling.js (see exports field in /.../node_modules/gosling.js/package.json)Managed to get it running with Vite. My amazement is beyond words
I had to use Vite for some external dependencies, but the current setup screws with my reloading. So currently I am using the vite dev http server for the page and have a shadow watch job running. But whenever shadow recompiles, vite reloads the page, which kind of defeats the whole purpose. Is there a way to stop vite from doing that? the shadow websocket seems to be connecting just fine, so the code reload should work in principle I basically copied https://github.com/belafonte/shadowcljs-vite, got this in shadow-cljs.edn
{:js-options {:js-provider :external
:external-index "public/js/imports.js"
:external-index-format :esm}}
and this vite config:
import { defineConfig } from "vite";
import { fileURLToPath } from "node:url";
import react from "@vitejs/plugin-react";
export default defineConfig({
plugins: [react()],
server: {
watch: {
// Exclude .cljs files
// so changes dont trigger multiple reloads
ignored: "**/*.cljs"
// usePolling: true <- this didnt make a difference
},
},
});
and run the whole thing with
npx shadow-cljs -A:dev watch app & npx vite
and include it with
<script type="module" src="/public/js/imports.js"></script>
<script defer src="/js/main.js"></script>
> Is there a way to stop vite from doing that? At the risk of stating the obvious, this doesn't seem like a CLJS question. I have no idea what Vite is and how it works, but I would guess that it has no idea how CLJS works and how shadow-cljs reloads CLJS code, and instead it does a full reloading.
Fair enough. It kind of relates to the whole saga of using JS interop, but if anything I guess it is a shadow-related question, as in "how do you make shadow and external bundlers play nicely with each other". But yeah ...
for what it's worth, seems like making vite ignore .js files instead of .cljs kind of did the trick
Hey I know this is a recurring theme that keeps phoenixing back, but what you folks are using to run your cljs tests in the CI? Any karma alternatives?
Is this an Elixir joke?
No haha, I just have a colleague that use this "phoenixing" for discussions that keeps coming back and I thought it was common