Reputation: 10662
It seems that the ClojureScript compiler compiles files in src
in alphabetical order. Is there a way to make it start with the main
target instead? I currently include a file aaa_init.cljs
in my projects which just happens to allow me to ensure certain things happen first... but this feels like an awkward solution.
It is useful to control the order that files are processed in so that I can ensure (enable-console-print!)
happens before printing, and I can use conveniences like defonce
, and re-frames dispatch
to set initial values.
Upvotes: 0
Views: 49
Reputation: 14549
Your question talks about two phases: compilation, and runtime. As far as I know, the order that you compile namespaces in will have no effect on runtime behaviour.
If you want (enable-console-print!)
to be called before printing, or to dispatch initial values to re-frame, then those should happen in the :main
function that you specify to the compiler. ClojureScript also has the ability to set :preloads
which run before your main function. These are typically more for development time tooling that you want compiled out of your production build, but could possibly be used for what you're asking.
Upvotes: 1