@kevin842 no. the chances of that working are also extremely slim.
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?
https://nodejs.org/api/process.html#process_event_uncaughtexception
> Warning: Using 'uncaughtException' correctly
is why it is not done by default
> 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.
btw if you just want a node-repl you can just use shadow-cljs node-repl
. that manages the node process for you.
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?most likely the library expects to be bundled by webpack
if you can live without the css you can set :js-options {:ignore-asset-requires true}
in your build config
Alright, I’ll try that as a first step 🙂 Thanks!
@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?
Like, perhaps I should be building the JS lib separately somehow instead?
…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.
I’d still be curious to hear if there’s a recommended workflow for building pesky JS libs separately though :)
Alright, I found this which goes over what my options are: https://code.thheller.com/blog/shadow-cljs/2020/05/08/how-about-webpack-now.html
I don't know what kind of library you are using here. never heard of anything doing require('foo.css').use();
before
thats even uncommon for webpack
that looks like a standalone project and not a library you include?
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
So I wanted to give that a shot before moving on to other options