You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've tried a few variations of this but always get absolute paths in my generated js. I see some references to PathMap in the fable source, but not sure if it's currently a supported feature. This is a nice feature to have to add source locations to logs, and generate stable ids based on source definitions for debugging.
This don't work in all situation but the assumption here is that I am able to identify a "unique enough" section of the path to decide to remove everything before that path.
You could imagine initialization the logger with the __SOURCE_DIRECTORY__ of the top level file for example.
This is mostly a workaround, and if we can support PathMap not to difficulty we should give it a try. But this would probably be limited to Fable (.NET) version as Fable (JavaScript) don't really understand MSBuild.
My assumption would have been that FCS was responsible to provide the correct path in this situation but I can be wrong.
Thanks for the example. I did think about doing that but I still ship code to a mobile decide with lots of long strings and the extra string manipulation operations. Perhaps I could use a babel plugin to remove them for now.
Im also experimenting with a fable plugin for autogenerating ids for zedux atom names as a workaround where I use the MemberRef info to grab the FullName of the identifier. It’s just a bit brittle since fable compiler plugins can’t influence the type of the Fsharp code, so I have to return a function and coerce with ‘!!’ to the actual return type.
I'm trying to get
CallerFilePath
to output relative paths using the ideas from the first answer here: https://stackoverflow.com/questions/65935784/is-it-possible-to-remove-the-full-paths-from-net-assemblies-created-with-dotnet.It suggests that adding config like the following to an
fsproj
orDirectory.Build.props
file should result in relative paths being produced:I've tried a few variations of this but always get absolute paths in my generated js. I see some references to PathMap in the fable source, but not sure if it's currently a supported feature. This is a nice feature to have to add source locations to logs, and generate stable ids based on source definitions for debugging.
Using fsc along with test code like:
The output is
The text was updated successfully, but these errors were encountered: