Fork me on GitHub
#shadow-cljs
<
2020-10-25
>
thheller07:10:39

@kevin842 no. the chances of that working are also extremely slim.

joshkh07:10:11

i have a :node-library build, and i'm attaching a JS runtime by running node out/index.js . whenever an error is thrown in the REPL, say for example from node's http package, the NodeJS process quits and i have to go through the process of restarting/re-attaching everything. is there a way to avoid this?

thheller07:10:35

> Warning: Using 'uncaughtException' correctly

thheller07:10:40

is why it is not done by default

joshkh07:10:59

> Attempting to resume normally after an uncaught exception can be similar to pulling out the power cord when upgrading a computer. Nine out of ten times, nothing happens. But the tenth time, the system becomes corrupted. i like this simile. thanks for pointing me to the docs.

thheller08:10:06

btw if you just want a node-repl you can just use shadow-cljs node-repl. that manages the node process for you.

👍 3
wombawomba14:10:24

So I’m trying to include a JS react library in my CLJS project. Unfortunately the JS library includes a bunch of statements that import CSS files, which causes shadow-cljs to complain:

[:app] Compiling ...
[:app] Build failure:
Failed to inspect file
[;...]/foo.css

it was required from
[...]/foo.js

Errors encountered while trying to parse file
[...]/foo.css
  {:line 20, :column 1, :message "primary expression expected"}
Is there a way to get around this?

thheller14:10:10

most likely the library expects to be bundled by webpack

thheller14:10:26

if you can live without the css you can set :js-options {:ignore-asset-requires true} in your build config

wombawomba14:10:53

Alright, I’ll try that as a first step 🙂 Thanks!

wombawomba15:10:43

@thheller so the code compiles fine when I set :ignore-asset-requires. Unfortunately, it still won’t load in a browser, because the JS code contains statements like require('foo.css').use();. Maybe there’s some other way to get this working?

wombawomba15:10:04

Like, perhaps I should be building the JS lib separately somehow instead?

wombawomba15:10:36

…on second thought, I think I’ll just give up for now and run the whole thing from JS in an iframe instead. The library I’m trying to use is just too messy for me to be able to figure out how to call from CLJS.

wombawomba15:10:02

I’d still be curious to hear if there’s a recommended workflow for building pesky JS libs separately though :)

thheller15:10:58

I don't know what kind of library you are using here. never heard of anything doing require('foo.css').use(); before

thheller15:10:27

thats even uncommon for webpack

thheller15:10:21

that looks like a standalone project and not a library you include?

wombawomba15:10:55

Yeah pretty much. There’s some discussion on how to use it as a library here though: https://github.com/eclipse-theia/theia/issues/1045

wombawomba15:10:24

So I wanted to give that a shot before moving on to other options