-
Notifications
You must be signed in to change notification settings - Fork 301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
type provider ResolutionFolder is empty #1868
Comments
Interesting, didn't know about that property. Fable contains almost no code specific for type providers, as they're basically resolved by the FSharp.Compiler.Service. If it works with VS Code it should work with Fable too. Maybe we're using an older version but I cannot see any recent fix related to this in dotnet/fsharp repo. |
Maybe it has do with the options we're passing to the F# compiler? Fable/src/Fable.Cli/ProjectCracker.fs Lines 397 to 408 in b470f3f
|
@zanaptak Yes, a test project would help, if you have one. |
@ncave @alfonsogarciacaro I have added a test project, clone my repo and check the TestWithFable instructions. |
Looks like the Looks like FSI sets it to the current folder:
but FCS sets it to the project folder:
Let me know which one you think is better, current dir or project path, and I'll make the change. |
Can Fable run a standalone fsx script outside of a project? If so, then possibly it should be conditional based on script vs. project context. But at least for a structured project it should be the project dir like FCS. That will be consistent with:
According to above, it is understood that project context and script context receive different configuration, with script context being the script directory. I have confirmed this by running In summary:
|
Works great after the update, thanks. 👍 |
Description
I have a type provider (as do others) for use with Fable. It erases to strings, and works great for the most part.
However, there is one problem: during the Fable compilation process, the type provider's
ResolutionFolder
configuration property, which is supposed to be the .fsproj directory, does not get set.Type providers are somehow instantiated with a
TypeProviderConfig
object like so:type MyTypeProvider (config:TypeProviderConfig) as this = ...
When compiled by Fable (or F# compiler services, or however they are interacting), the config object has the other properties set but not the
ResolutionFolder
. Consequently, at compilation time we have no way to find source data files with paths relative to project root, we can only find absolute paths.Here is some debug logging from my type provider to illustrate this further.
At design time in VS Code it sets the ResolutionFolder:
If I build with
dotnet build .\src\App.fsproj
, it sets the ResolutionFolder (also changing current working dir):If I build with webpack which runs Fable.Cli.dll, the folder is empty string (not null, in case it matters):
I started to poke around the Fable codebase but quickly got lost so I'm asking here. Do you think it might be possible to figure out how to set this property correctly? I can also provide a test project if necessary if someone is willing and able to dig further.
Related information
The text was updated successfully, but these errors were encountered: