On Thursday, October 6, 2016 at 3:28:13 PM UTC-4, Daniel Compton wrote: > Hi Luke > > > You’re spot on here, and this is something that took me a little while to > figure out as well. Sourcemaps don’t necessarily have to include the cljs/js > sources, they just have a mapping from the generated JS to the original > source file. For a browser (or exception tracker) to be able to show you the > original file, it needs to have access to it. In development this isn’t > usually a problem, but in production, you either need to upload your original > CLJS files to your webserver along with main.js and main.js.map, or you can > send them all to Raygun separately. As you’ve mentioned, neither of those > options are particularly great. > > > Luckily, the source map spec allows for providing sourcesContent in the > sourcemap file. This includes the content of all of the original cljs > sources, which will give you one (very large) sourcemap file you could upload > to your exception tracker. There is an open ticket on the closure-compiler to > support sourcesContent for sourcemaps. It looks like this is 95% of the way > there to being usable in the Closure Compiler, and is probably already usable > from the ClojureScript compiler, it just needs someone to do the work to > integrate it. CLJS-658 is some prior art on this, and CLJS-1755 is the ticket > I created to track this. > > > On Fri, Oct 7, 2016 at 5:10 AM Luke Horton <[email protected]> wrote: > 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. > > > -- > > > > > > Daniel
Thanks for the great reply Daniel. As I continued to search for answers it felt like I was following in your footsteps a-la https://github.com/google/closure-compiler/issues/1890/ -- 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.
