Hi guys,

I'm having a misunderstanding with sourcemaps, and I was hoping someone can 
clarify things.

If I compile in :advanced mode, I get a single main.js file and the main.out 
directory containing both js and cljs versions of my application code.

If I add a :source-map "main.js.map" configuration, I get the main.js file with 
the correct //# sourceMapUrl=main.js.map directive appended, and the 
main.js.map file itself.

If I serve /build which contains main.js, main.js.map, as well as the output 
main.out directory, sourcemaps work perfectly.

If I serve only main.js and main.js.map (and don't include main.out inside 
/build), the application still runs fine. However, the sourcemaps no longer 
work. 

I guess this means I don't understand how the sourcemaps are linked.

If I look at the generated map, I see the sources array contains mostly links 
pointing to main.out, such as ["main.out/foo/bar.js", "main.out/foo/bar.cljs"].

Does this mean, then, that the entire main.out directory must be available when 
serving main.js in order for main.js.map to correctly map to source files?

This makes things like sentry.io and raygun much more complicated to configure 
correctly. For example, sentry.io allows you to pre-upload source files 
(minified) and sourcemaps. If an error is encountered, rather than running a 
GET /some-source.js.map (which could be huge and therefor slow to respond), it 
will reference the already uploaded map file to find the correct line/col of 
the error.

For cljs apps to work properly with similar error capture tools, we would have 
to pre-upload every single file (both js and cljs) inside main.out OR expose 
main.out/* so that an error would trigger GET main.js.map -> 
main.out/foo/bar.js -> main.out/foo/bar.cljs.

Is this correct, or am I going about this all wrong? 

-- 
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 https://groups.google.com/group/clojurescript.

Reply via email to