Fork me on GitHub
#shadow-cljs
<
2022-03-18
>
Pepijn de Vos10:03:52

Hrm not sure why but Firefox debugger is showing "this page has no source" with 2.17.8 which worked in 2.13.0

Pepijn de Vos10:03:54

Also, a warning that wasn't there before:

[To redirect Truffle log output to a file use one of the following options:
* '--log.file=<path>' if the option is passed using a guest language launcher.
* '-Dpolyglot.log.file=<path>' if the option is passed using the host Java launcher.
* Configure logging using the polyglot embedding API.]
[engine] WARNING: The polyglot context is using an implementation that does not support runtime compilation.
The guest application code will therefore be executed in interpreted mode only.
Execution only in interpreted mode will strongly impact the guest application performance.
For more information on using GraalVM see .

pinkfrog12:03:55

When running shadow watch, I saw this:

pinkfrog12:03:05

Why shadow install this?

Pepijn de Vos15:03:03

Looks like it's reagent that requires it, no?

pinkfrog15:03:44

I remember that shadow will ignore those requirements from deps.cljs

thheller18:03:38

shadow will install dependencies declared in deps.cljs files

wombawomba15:03:31

How does shadow-cljs decide which code goes in which module? I have a situation where I have a main module and several 'per-view' modules (let's say view-a, view-b, ...). All these modules, including main import a specific ns (let's call it my-ns), but only some of the modules actually use it. Still, almost all the code from my-ns ends up in main.js. Is there a way to 'move' this code out of main, so that it doesn't get loaded except in the views that use it?

wombawomba15:03:10

Yeah, that's what I'm using. My question is about how to move code from a 'base' module (`shared` in that example) into the modules that actually use it.

Pepijn de Vos16:03:25

I guess maybe try to make more granular shared modules but tbh I'm not sure. I tried code splitting and ran into weird bugs with React or something.

thheller18:03:39

@U15RYEQPJ namespaces are moved as far to the other edges as possible. if many namespaces depend on a thing it'll be moved to the outermost common module

thheller18:03:50

so if all modules just depend on main that is the only place it can go. you can introduce another empty module with just :entries [] and have the mods depends on that too. that gives it a chance to move more maybe

thheller18:03:47

but if main also requires the namespace you want move it will not be moving

thheller18:03:26

:advanced can split but the code in namespaces but only if actually used in certain places. if 2 or more places use a thing it can't move

wombawomba18:03:10

Yeah I noticed that part of the code from this is gets moved to where I want it to be.

wombawomba18:03:09

If two modules that aren't main use the code, shouldn't it be possible to set up an 'intermediate' ns between those modules and main and have the code go there?

thheller18:03:45

in theory yes but it doesn't work that way

thheller18:03:34

it can't introduce new modules so it can only stay in main. this is by design. you can achieve the exact splits you want via tuning :modules

wombawomba18:03:45

@U05224H0W are you saying that if i introduce the appropriate 'intermediate' modules myself, the code would get pulled up into them automatically?

wombawomba18:03:01

If so, that's definitely good enough for me :)

thheller18:03:51

well all depends on what kind of code it is. not everything is moved by closure

thheller18:03:07

really hard to make generic statements about this stuff

wombawomba20:03:52

Alright, thanks

Pepijn de Vos15:03:00

How can I use inline to load some resource from the public folder? Or... what is a better place to store resources?

864 | (def resistor-icon (rc/inline "public/css/icons/resistor.svg"))
--------------------------^-----------------------------------------------------
Encountered error when macroexpanding shadow.resource/inline.
Resource not found: public/css/icons/resistor.svg at line 864 nyancad/mosaic/editor.cljs

Pepijn de Vos16:03:49

I added "public" to :source-paths and that solved it

thheller18:03:44

don't do that. move the file onto the classpath instead

rende1119:03:58

Can someone help? How I can fix it?

:shadow.build.npm/js-invalid-requires - {:resource-name "node_modules/@monaco-editor/loader/lib/cjs/loader/index.js", :requires [{:line 135, :column 2}]}
At line 135:
require(['vs/editor/editor.main'], function (monaco) {
    storeMonacoInstance(monaco);
    state.resolve(monaco);
  }, function (error) {
    state.reject(error);
  });

thheller19:03:32

can't. this is not supported by shadow-cljs. you can use webpack instead as described here https://code.thheller.com/blog/shadow-cljs/2020/05/08/how-about-webpack-now.html

thheller19:03:02

monaco is pretty bundler unfriendly

thheller19:03:15

I believe it even requires a plugin when using webpack. at least it used to

rende1119:03:44

Do you have some examples with it?

thheller19:03:08

no but I'm sure the official docs have a section about building