Marc Fawzi <[email protected]> writes:

> I did some reading on enabling source maps for other languages (more
> material exists for e.g. coffeescript) and I think the problem is that lein
> cljsbuild is not adding that special comment to index.html to tell the
> browser about the source map
>
> //# sourceMappingURL=/path/to/file.js.map
>
> in this case "dev/main/core.js.map"
>
> <!-- scripts and styles -->
> <script src="http://fb.me/react-0.12.1.min.js";></script>
> <script src="dev/goog/base.js" type="text/javascript"></script>
> <script src="dev/app.js" type="text/javascript"></script>
> <script type="text/javascript">goog.require("main.core");</script>
>
> But shouldn't goog.require be smart enough to add that? I have no idea
> since I've never used goog.* or the Closure compiler
>
> It's it lein's job to put that special comment line or is it Google's
> Closure's job? Or how does the line get added? We're definitely not sending
> an X header for source maps, so we must have that special comment
> (according to what I read)
>
> What am I missing here?
>
>
> On Sat, Jan 24, 2015 at 4:31 PM, David Nolen <[email protected]> wrote:
>
>> Are you sure the source maps are accessible to the browser? You should see
>> them getting loaded in the Network tab.
>>
>> David
>>
>> On Sat, Jan 24, 2015 at 7:20 PM, Marc Fawzi <[email protected]> wrote:
>>
>>>
>>> at work, we've implemented a few features/pages in cljs without source
>>> map support.. to me that's like using the force, but we know we will
>>> eventually get stuck trying to fix a bug that we can't trace to the code
>>> manually
>>>
>>> so we need source map support asap to smooth out the cljs adoption
>>> process at our company
>>>
>>> the way we develop is by running "lein cljsbuild auto dev" and
>>> refreshing the browser once we make changes (figwheel is on my list of
>>> tools to investigate)
>>>
>>> anyway, the problem is with source maps
>>>
>>> We run node or python based web server to serve index.html (see below)
>>> and we inherited this sample project.clj file
>>>
>>> (defproject CHANGE-ME-ME "0.1.0-SNAPSHOT"
>>>   :description "CHANGE-ME"
>>>   :url "https://CHANGE-ME";
>>>   :dependencies [[org.clojure/clojure "1.6.0"]
>>>                  [org.clojure/clojurescript "0.0-2280"]
>>>                  [reagent "0.4.2"]
>>>                  [cljs-ajax "0.2.6"]]
>>>
>>>   :plugins [[lein-environ "0.5.0"]
>>>             [lein-cljsbuild "1.0.3"]]
>>>
>>>   :cljsbuild {:builds [{:id "dev"
>>>                         :source-paths ["src"]
>>>                         :compiler {:optimizations :none
>>>                                    :output-to "public/dev/app.js"
>>>                                    :output-dir "public/dev/"
>>>                                    :source-map true}}
>>>                        {:id "prod"
>>>                         :source-paths ["src"]
>>>                         :compiler {:optimizations :advanced
>>>                                    :output-to "public/js/app.js"
>>>                                    :pretty-print false}}
>>>                        ]}
>>>
>>>   :min-lein-version "2.0.0")
>>>
>>> The index.html is
>>>
>>> <!DOCTYPE html>
>>> <html>
>>> <head>
>>>     <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
>>>     <title>Reagent Starter Project</title>
>>> </head>
>>> <body>
>>> <div class="container">
>>>     <div id="app"></div>
>>> </div>
>>>
>>> <!-- scripts and styles -->
>>> <script src="http://fb.me/react-0.12.1.min.js";></script>
>>> <script src="dev/goog/base.js" type="text/javascript"></script>
>>> <script src="dev/app.js" type="text/javascript"></script>
>>> <script type="text/javascript">goog.require("main.core");</script>
>>> </body>
>>> </html>
>>>
>>> I have not used anything but pure JS before so I'm not sure what to do to
>>> get source maps working but as of now they are enabled in chrome but
>>> exceptions are displayed in the console in cljs/reagent JS sources like
>>> ratom.js and not in the cljs file
>>>
>>> I read the wiki on source maps and tried using source-map-path but that
>>> didn't work
>>>
>>> does anyone have an example of source maps that works with a web server?
>>>
>>> any pointers will be appreciated
>>>
>>> very frustrating and nerve wrecking that we ca't debug cljs sources
>>>
>>> help!
>>>
>>> Thank you in advance
>>>
>>> Marc
>>>
>>>
>>>
>>>
>>>  --
>>> Note that posts from new members are moderated - please be patient with
>>> your first post.
>>> ---
>>> You received this message because you are subscribed to the Google Groups
>>> "ClojureScript" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an
>>> email to [email protected].
>>> To post to this group, send email to [email protected].
>>> Visit this group at http://groups.google.com/group/clojurescript.
>>>
>>
>>  --
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "ClojureScript" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at http://groups.google.com/group/clojurescript.
>>
>
> -- 
> Note that posts from new members are moderated - please be patient with your 
> first post.
> --- 
> You received this message because you are subscribed to the Google Groups 
> "ClojureScript" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/clojurescript.

Have you set the :source-map compiler option? With it set to a path,
source maps work just fine (in :advanced and :none) for me.

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Attachment: signature.asc
Description: PGP signature

Reply via email to