Fork me on GitHub
#squint
<
2022-09-14
>
Mario Trost14:09:11

Here is my first try using Remix through Squint: https://github.com/MTrost/remix-squint

Mario Trost14:09:53

Biggest obstacle right now is using CLJS standard library functions breaks the Remix build because of unsupported require statements in the build:

Mario Trost14:09:01

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 /build/index.js to a dynamic import() which is available in all CommonJS modules.

Mario Trost14:09:20

Additional observations: 1. .mjs files are not supported as valid files inside the routes folder. .jsx is okay so putting #jsx inside those files kind of solves that. 2. Generally I was surprised by how simple it was. But it’s just using the Remix starter which is a very simple example.

Mario Trost14:09:55

I will try a deploy to CloudFlare in the coming days.

borkdude14:09:19

@ULA8H51LP 0. Core functions: require statements? Who wrote these? Maybe you can try "type": "module" in package JSON? 1. We could make the extension configurable, would that help?

Mario Trost15:09:11

re 0.: I think that’s a Remix problem, will keep you posted. 1. That would help for sure, but it’s not a urgent at all right now

Mario Trost16:09:02

Yes, it’s a problem of Remix and ESM only packages: https://remix.run/docs/en/v1/pages/gotchas#importing-esm-packages type: module in package.json does not solve it unfortunately. The solution mentioned in the Remix docs also doesn’t work and scanning the Remix Discord it looks like there are other ESM only libs not working as they should.

Mario Trost16:09:44

Javascript module system is quite a dumpster fire right now and many libraries ship CJS and ESM code in order to be used from anywhere else.