Open kevincolyar opened 10 years ago
Typically I don't use :optimizations :none
in favor of :optimizations :whitespace
during development in order to avoid having to do the whole <script>
song and dance in the HTML. You might try that.
Hmm, using :optimizations :none
seems to be the only way to build it with source maps.
I tried settings :source-map to "main.js.map" which worked but jacked my lein cljsbuild auto
times up to 25 seconds for each change (opposed to <1s) because it has to recompile the source map each change (I assume).
Hmm, using
:optimizations :none
seems to be the only way to build it with source maps.
@kevincolyar That certainly is not the case. You can see an example here.
I tried settings :source-map to "main.js.map" which worked but jacked my
lein cljsbuild auto
times up to 25 seconds for each change...
Yeah, that sounds about right. You'll have to decide whether it's worth the wait or not (or get a quad core :smile:). A good combination is to use something like austin and work with a bREPL to get faster feedback.
@noprompt thanks for the example! I'm using om too so that will be helpful.
I'll try messing with my index.html setup to see if I'm doing something wrong there. I'll take another look at austin, too.
Thanks for the help.
I think I've narrowed down the issue to this line which seems to be required when using a source-map directory.
<script type="text/javascript">goog.require("activity_log.core");</script>
I don't understand well enough how secretary's defroute macro is working to know why wouldn't be defined when requiring this file that defines my routes.
Here's all of my js includes:
<script src="http://fb.me/react-0.9.0.js"></script>
<script src="out/goog/base.js" type="text/javascript"></script>
<script src="main.js" type="text/javascript"></script>
<script type="text/javascript">goog.require("activity_log.core");</script>
From what I can tell, the goog.require is starting my application. I don't have to use this line when I build in release because I'm not using source maps output directory:
:cljsbuild {
:builds [{:id "dev"
:source-paths ["src"]
:compiler {
:output-to "main.js"
:output-dir "out"
:optimizations :none
:source-map true}
}
{:id "release"
:source-paths ["src"]
:compiler {
:output-to "main.js"
:optimizations :advanced
:pretty-print false
:preamble ["react/react.min.js"]
:externs ["react/externs/react.js"]}
}]})
@kevincolyar I'm thinking that the two builds are compiling to the same output file. Can you please try naming the different builds to output to different js files and update the index.html to point to the right one? i.e. :output-to "main_dev.js
for the dev one and update the index.html to use that
I'm trying to use secretary in conjunction with om and it works fine using the release cljsbuild settings, however the development settings don't work. I'm not sure if it's the source map that's messing it up or the js include in the index.html.
https://github.com/swannodette/om#using-it
Using the following dev build settings I get an error that defroute is undefined: