dotnet-websharper / core

WebSharper - Full-stack, functional, reactive web apps and microservices in F# and C#
https://websharper.com
Apache License 2.0
593 stars 52 forks source link

Use file location for source maps #1354

Open granicz opened 11 months ago

granicz commented 11 months ago

This was reported on Slack by @TheAngryByrd:

image

Jand42 commented 11 months ago

Answer: not with 6.1 release as is. Needs changing this line to calculate relative path https://github.com/dotnet-websharper/core/blob/6a37a654a8b8e89714685b25b73b9d9441734a40/src/compiler/WebSharper.Compiler.FSharp/CodeReader.fs#L1239 and ideally same in C#.

However, for 7.0+ with module based .js, source mapping is currently temporarily disabled. Once the solution for production bundling is in place, we can reintroduce it. We will need to switch to use external source files this time, not embedded in the map file, so that many .js outputs can point to the same .cs/.fs

TheAngryByrd commented 11 months ago

Main benefit (I think) is I can then debug in vscode by setting sourceMapPathOverrides (yes that debugger is archived but the current extension doesn't have this documented well). I can do it today but it's not a little strange as you have to find the file in the Loaded Scripts section and can't set breakpoints directly in the editable file. Happy to write some docs up how I currently got it working if you want to try it yourself.

granicz commented 11 months ago

@TheAngryByrd Yes, please do! Thanks!