JS source mapping

896 views
Skip to first unread message

Bruno Garcia

unread,
Mar 3, 2012, 8:21:02 PM3/3/12
to haxe...@googlegroups.com
Initial support for JS source mapped debugging has been added to trunk!
This will give you haXe line numbers in stack traces, just like Flash.
It'll also let you step through haXe instead of JS when debugging,
here's a screenshot of that in Chrome:
https://share.aduros.com/EloeYNCrCHZnG9AEzD_fIg.png

To test drive it, you'll need the latest dev channel version of Chrome,
and turn on "Enable source maps" in the inspector settings. Support in
Firefox will be available when they implement it. Then compile your
project with -debug and haXe will output a .map file which contains the
debug information.

Let me know how it works for you! haXe is the first language I know to
implement JS source mapping, so there may be some issues.

Bruno

Philippe Elsass

unread,
Mar 4, 2012, 3:18:00 AM3/4/12
to haxe...@googlegroups.com
This is awesome!




--
Philippe

Franco Ponticelli

unread,
Mar 4, 2012, 10:54:27 AM3/4/12
to haxe...@googlegroups.com
It is and it seems to work pretty well.

Michael Cann

unread,
Mar 4, 2012, 10:56:23 AM3/4/12
to haxe...@googlegroups.com
Wow! This is big! Great news, well done!
Mike Cann
http://www.mikecann.co.uk/

Dion Whitehead Amago

unread,
Mar 5, 2012, 2:09:14 AM3/5/12
to haXe
Awesome work!

Philippe Elsass

unread,
Mar 12, 2012, 5:17:05 PM3/12/12
to haxe...@googlegroups.com
Ok tried it in a sample app and can't seem to make it work.

I have the dev channel, generated in debug mode the .map (both are under /js in the project), and I can see a note at the end of the script:
//@ sourceMappingURL=script.js.map

The map looks like this:
{
"version":3,
"file":"script.js",
"sourceRoot":"file://",
"sources":["D:\Dev\haxe\Libraries\haxe\std\js\_std\EReg.hx","D:\Dev\haxe\Libraries\haxe\std\IntIter.hx","D:\Dev\test\src\Main.hx","D:\Dev\haxe\Libraries\haxe\std\js\_std\Std.hx","D:\Dev\haxe\Libraries\haxe\std\StringBuf.hx","D:\Dev\test \src\jquery\TouchScroll.hx","D:\Dev\haxe\Libraries\haxe\std\js\Boot.hx","D:\Dev\haxe\Libraries\haxe\std\js\Lib.hx","D:\Dev\haxe\Libraries\haxe\std\Math.hx","D:\Dev\haxe\Libraries\haxe\std\js\JQuery.hx"],
"names":[],
"mappings":";;;;;;;CA8BC,EAAM,FAAU,AAAU;CAC1B,EAAiB,QAAiB,VAAE;;[snip]"
}

So what can be wrong?

Bruno Garcia

unread,
Mar 12, 2012, 5:24:57 PM3/12/12
to haxe...@googlegroups.com
On 03/12/2012 02:17 PM, Philippe Elsass wrote:
> So what can be wrong?

Did you enable source maps in the Chrome? (by clicking the little gear
button in the bottom right of the inspector and checking that setting)

If it is on, maybe there's some issue with Windows style paths.

Bruno

Philippe Elsass

unread,
Mar 12, 2012, 5:47:40 PM3/12/12
to haxe...@googlegroups.com
Ha I found the issue - indeed a Windows style path issue.

I changed all backslashes into unix-style forward slashes and it worked. 

I guess I'll have to wait for the next nightly to try it more in depth but aside from that it seems to work great :)

Philippe Elsass

unread,
Mar 13, 2012, 6:18:28 AM3/13/12
to haxe...@googlegroups.com
Another little issue I found: 
js/Lib.hx still contains hardcoded old-style debug code (using $s).

--



--
Philippe

Bruno Garcia

unread,
Mar 13, 2012, 7:13:52 AM3/13/12
to haxe...@googlegroups.com
Both of these should be fixed as of r4275 :) Let me know if that gets things working in Windows.

Bruno

Franco Ponticelli

unread,
Jun 19, 2012, 10:12:11 AM6/19/12
to haxe...@googlegroups.com
Source mapping used to work for me (my JS project has not been compiled for a couple of months now) but now doesn't work anymore. The map file is correctly generated and referenced and Chrome has the source mapping option enabled. Any idea?

Franco

Bruno Garcia

unread,
Jun 19, 2012, 3:20:50 PM6/19/12
to haxe...@googlegroups.com
Can you verify that Chrome is downloading your .map? (from web server logs)

If so, maybe the source map is invalid. What haxe version?

Bruno

Franco Ponticelli

unread,
Jun 19, 2012, 3:33:58 PM6/19/12
to haxe...@googlegroups.com
Of course you are right ... it was a 404 and now it works ... my bad, sorry for the noise.

Franco

iruff...@gmail.com

unread,
Sep 14, 2012, 11:17:56 AM9/14/12
to haxe...@googlegroups.com

I'm on Windows 7 using Sublime to build. I see that my map files exists, it's referenced in my generated js file, and I've got the latest Chrome with Source Maps enabled. Am I missing something, because I can't get Chrome to grab my source map? There's no record of an attempt to download it from the network tab. Any help would be appreciated.

Franco Ponticelli

unread,
Sep 14, 2012, 11:19:53 AM9/14/12
to haxe...@googlegroups.com
Are you using a webserver to access your files?

Franco

On Fri, Sep 14, 2012 at 9:17 AM, <iruff...@gmail.com> wrote:

I'm on Windows 7 using Sublime to build. I see that my map files exists, it's referenced in my generated js file, and I've got the latest Chrome with Source Maps enabled. Am I missing something, because I can't get Chrome to grab my source map? There's no record of an attempt to download it from the network tab. Any help would be appreciated.

--

Bruno Garcia

unread,
Sep 14, 2012, 6:58:00 PM9/14/12
to haxe...@googlegroups.com
Annoyingly, Chrome won't record the source map download in the network
tab. Looking at web server access logs seems to be the only way to
verify that Chrome is requesting and finding the map.

If it definitely downloaded the map but refuses to use it, that might be
a bug in either Haxe source maps or Chrome, and you should send along a
reproducible test case :)

Bruno

Eric Priou

unread,
Jan 3, 2013, 1:12:56 PM1/3/13
to haxe...@googlegroups.com
Hmmm... is there something obvious I'm missing.  I enabled source maps in chrome, and am compiling with the -debug flag in HaXe.  For some reason when I compile, the compiler doesn't generate a source map.
Strange, that's work here…
Check your commandline twice ?
---
Eric Priou aka erixtekila

Franco Ponticelli

unread,
Jan 3, 2013, 1:13:23 PM1/3/13
to haxe...@googlegroups.com
Or maybe you don't have a Haxe version recent enough?


Hooman Rowshanbin

unread,
Jan 3, 2013, 1:34:25 PM1/3/13
to haxe...@googlegroups.com
Ah that as it!  Turns out I was only updating FlashDevelop, not HaXe.  Thanks!

glantucan con golo lojo

unread,
Jun 26, 2013, 8:16:23 PM6/26/13
to haxe...@googlegroups.com
Wow!!!

Thanks for this guys!!!
I was just wonderng how to debug the html5 version of my app and found this.
Thanks, really!!
It's awesome.
Did I say thanks?

;D

 

david quertelet

unread,
Jun 27, 2013, 3:28:43 AM6/27/13
to haxe...@googlegroups.com
btw 
it does not work with latest safari 6.1 which has recently source mapping
--
---
You received this message because you are subscribed to the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Eric Priou

unread,
Jun 27, 2013, 12:30:09 PM6/27/13
to haxe...@googlegroups.com
I wonder is openFL could benefit this feature on html5 target also ?
Reply all
Reply to author
Forward
0 new messages