Skip to content

Latest commit

 

History

History
38 lines (26 loc) · 1.94 KB

Advanced-Setup.md

File metadata and controls

38 lines (26 loc) · 1.94 KB

Advanced Setup

If your project does not use a :main config then you will need to do more work to setup your project.

You will need to manually set the Closure defines, and require day8.re-frame-10x.preload on your page before you initialize your application. An example:

<script>var CLOSURE_UNCOMPILED_DEFINES = {"re_frame.trace.trace_enabled_QMARK_":true};</script> <!--Make this come first-->
<script src="/cljs/goog/base.js" type="text/javascript"></script>
<script src="/cljs/main-dev.js" type="text/javascript"></script>
<script>goog.require("day8.re_frame_10x.preload");</script> <!--Add this before the app's goog.require-->
<script type="text/javascript">goog.require("todomvc.core");</script>

<script>
        window.onload = function () {
            todomvc.core.main();
        }
</script>

These are the two key lines that need to be added to your bootstrap process.

var CLOSURE_UNCOMPILED_DEFINES = {"re_frame.trace.trace_enabled_QMARK_":true};
document.write('<script>goog.require("day8.re_frame_10x.preload");</script>');

This setup is inherently project specific, so open an issue if you have trouble, and we'll try and figure it out. Or if possible switch to using a :main.

Using :optimizations :none is recommended

re-frame-10x is designed for development time debugging. The overhead that it imposes would not be suitable for production builds, so it is compiled out by default. If you really want to use re-frame-10x with a production build, you will need to make sure that the goog.DEBUG Closure define is true to ensure that the tracing isn't dead code eliminated.

There may be more hurdles to cross after this one, Here Be Dragons, if you figure it out, let us know!

Using Shadow CLJS?

Dependencies will be automatically installed via shadow-cljs's deps.cljs transitive dependency mechanism.