0

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.

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.