If I want to rewrite cljs sources during compilation is there a way to use build hooks to get the result of reading the forms and manipulate the forms prior to macro expansion ? The only way I have figured out so far is hooking into compile-prepare and replacing every cljs file in build state with one at a different tmp path that has been modified. Thoughts ?
what kind of "rewrite" are you thinking about?
currently there is no way to hook into the compiler at that level
Hi there o/ Is there any way that I could create standalone js files for each of the entries (or modules)? Or should I create a new build for each (could I watch them all at the same time, I guess it's doable from my part if this is the only way o/)? In the example below, it outputs a shared.js file, it's fine, but standalone would be good for now (I'm trying to use Cypress).
{:builds :....
{:target :browser
:output-dir "out/testtt"
:compiler-options {:infer-externs :auto}
:modules {:shared {:entries [cypress.core]}
:cypress.blablabla.edit-test
{:entries [cypress.blablabla.edit-test]
:depends-on #{:shared}}
:cypress.blablabla.add-test
{:entries [cypress.blablabla.add-test]
:depends-on #{:shared}}}}}
And thanks for this very awesome piece of software, Thomas o/@pfeodrippe IFAIK, when you compile the release version, each module will be a single JS file
I don't understand the question? the whole point of modules is creating multiple files? if you only want one file only use one module?
Oh sorry, I want to create a standalone file for each cypress.blablabla...
namespace, right now it creates a thin js file for each, it gives me SHADOW_ENV is not defined
error. The only way to do this is through a build (maybe any other dynamic way)?
I'm missing some basic information I guess. you are supposed to load the shared.js
first before loading the other module
(that is where SHADOW_ENV
comes from)
why does it have to be a standalone file?
I have never used cypress so I don't have a clue how it works
but to answer your question: no, there is no way to make modules standalone using shadow-cljs
you could do it yourself by just concatenating shared.js
+ the module file
but I don't get why you'd need to do that
Oh, thanks. Yes, to load shared.js
before appears to be the best approach, I just wanted to check if there was another way.
Thanks, @thheller and @mauricio.szabo o/
well technically the :target
abstraction in shadow-cljs would allow for a :target :cypress
and then just take the minimum amount of config to emit the output that fits best for cypress
but that is going to be a bit of work since none of the underlying code is documented 😉
Oh very nice! Well, I can check how karma (or some simpler one) works, thanks again o/