Debugging with source maps

Fuse 0.20.2, OSX 10.11.5

I’ve done a Fuse app with F#/Fable following the excelent guide by Dave Thomas: http://7sharpnine.com/blog/fable-fuse-template/

Now I’m trying to debug the code with Visual Studio Code. I can debug the JS code normally but it’s not possible to debug the original F# code using source maps. I’ve noticed the debugger doesn’t stop in the actual JS file but in a copy that can’t be edited and is tagged as “core module” (and which btw doesn’t update unless I restart VS Code). Moreover, this copy wraps the original code with the following function:

(function(module, exports, require) { "use strict";

/ Original Code /

//# sourceMappingURL=test.js.map
 })

The problem is, as can be seen above, that the comment indicating where the source map can be found is not in the last line any more, so Visual Studio Code cannot detect it.

Would it be possible to fix that?

Thanks a lot for your incredible work with Fuse!

Hey Alfonso, and thanks for your report!

I’m not sure if it would be possible to get rid of the module wrapping as it’s essential for our handling of modules. Perhaps a quick hack to get this going would be for us to move any comments on the last line of the user code outside of the module scope. Do you think that would work for you?

Cheers!

Hi Olle!

Thanks a lot for your reply. Sorry I was not clear in my report. Yes, I guessed the wrapping couldn’t be removed and I was actually thinking of the same solution as you proposed: detect if there’s a source map comment in the last line and move it outside the wrapping. It’d be fantastic if you can do that :slight_smile:

Thank you very much and have a nice weekend!

Great, thanks for your reply. I’ve created an internal issue on this and we’ll try to keep you posted when there’s progress. :slight_smile: