Fork me on GitHub
Mario Trost20:01:46

Squint needs a common-js bundle. Just dropping this here this Sunday night right before I go to bed 😄 Reason: Most common-js tools do not play nice with esm and most JavaScript tools are common-js. (almost verbatim stolen from here: ) Instructions how to do it: I can create an issue for it if not out of the question Anyways, good night and thanks for all the tools you give us 🙂


I think it's better to come up with a real example that demonstrates the problem. What tools for example

Mario Trost07:01:31

Yes, sorry for not giving more specifics yesterday: just wanted to drop it, so I have to follow up. One example: The output of Remix builds is cjs, not esm. As soon as I import something from squint I get the error:

Error [ERR_REQUIRE_ESM]: require() of ES Module (...)/node_modules/squint-cljs/core.js from (...)/build/index.js not supported.
Instead change the require of core.js in (...)/remix-squint/build/index.js to a dynamic import() which is available in all CommonJS modules.
Yesterday I changed squint/core.js to cjs using and removed the type: module from package.json and it worked. But I'm also not building anything serious right now, just playing around, so no urgency here in any way.


Wouldn't you be able to use Remix with Clojurescript? Since it's all backend Node.js ?

Mario Trost20:01:03

I don't know the answer to the first question, but regarding the second: The Remix compiler runs in nodejs, but Remix itself runs in many places. I've primarily deployed it to Cloudflare, which isn't Node.js. And it's not just backend runtimes but also code that runs in the browser. (but perhaps I misunderstand your question and you only meant the compiler). Short example of a route file:

import { json } from "@remix-run/node";
import { useLoaderData } from "@remix-run/react";

export function loader() {
  return json({ hello: "World" })

export default function App() {
  let data = useLoaderData()
  return <h1>{data.hello}</h1>
The loader will only ever run on the server, becoming a GET endpoint, while the App is server rendered only on page load, after that it's part of a "normal" React app running in the browser. Coming back to your first question: You could well be right that Clojurescript itself would be enough. I don't know enough to be sure, only working in Clojurescript since September (but following developments in the ecosystem way longer). ClojureScript and shadow could probably work here but Squint's more 1-to-1 compilation seemed a better fit.


I see, so Remix has to do a lot of rewriting and custom building to spit out both a frontend and a backend out of the same JS code? If so, I can see it being finicky to Clojurescript compiled JavaScript.

Mario Trost07:01:54

Yes, exactly, and also building for different platforms. That's what I thought. Glad to get it confirmed by a more experienced Clojure dev 🙏