I've updated all my dependencies to their latest version and upgrade from fable-loader 2.0 to 2.1 and installed fable-compiler.
// Edit: I've also removed dotnet-fable and changed my build targets to call webpack directly
Since then I got the build error:
ERROR in ./WebUI.Fable/material_ui.fs
Module Error (from ./node_modules/fable-loader/index.js):
D:/Repositories/P-PLUS/WebUI.All/WebUI.Fable/material_ui.fs(1,1): error FABLE: Cannot get type info of generic parameter, please inline or inject a type resolver
@ ./WebUI.Fable/pplus_common.fs 1:0-2063 5:31-72 6:31-72 7:30-65 8:36-75 9:33-68 10:43-79 11:51-84 12:40-74 13:40-75 14:35-71 15:52-85 16:46-79 17:34-68 18:34-70 19:34-68 20:34-68 21:29-62 22:33-67 23:30-64 24:31-63 25:30-65 26:38-72 27:39-74 28:34-68 31:46-79 32:49-81 36:17-56 37:12-46 38:31-69 39:30-65 40:19-55 41:20-58 42:10-45 43:32-67 44:37-75 45:12-46 46:22-56 47:18-52 48:36-69 51:13-47 52:12-46 53:9-41 56:8-42 57:7-40
@ ./WebUI.Fable/WebUI_Fable.fs
@ ./WebUI.Fable/WebUI.Fable.fsproj
@ ./src/WebUI.js
Everything is fine if I open the material_ui.fs or pplus_common.fs in Visual Studio or VsCode. The lines which are marked as errors from the output are empty or the middle part of a function or value binding.
fable-loader: 2.1.2
fable-compiler: 2.1.8
webpack: 4.28.3
Operation System: Windows 10
You won't see an F#/intellisense error here because it's a Fable requirement when working with generic types.
If your code or the library is using reflection, the function needs to be inlined or have an [<Inject>] variable in it. For example: https://github.com/MangelMaxime/Thoth/blob/master/src/Thoth.Json/Decode.fs#L1017-L1020
You should check if your code or the library is using reflection somewhere.
@MangelMaxime And how do I know which function I need to inline or add the [<Inject>] attribute? The line numbers in the error message points to an emtpy line or code fragments
// Edit: Is there an editor plugin which give me the ability to see those errors with intellisense?
By looking at the code and seeing which code is using reflection. Or isolating the problem in a small repro case to isolate the function.
I don't know why Fable isn't show the correct line however.
I don't see any code with reflection in the given files (material_ui.fs & pplus_common.fs). There are just type and function definitions with concrete types as arguments. No generic types or refelction
I will now downgrade to Fable 2.0.11
If I can help you in any way, just aks me :)
// Edit: In the file material_ui.fs I have a lot of function calls like this
let teal500 : Color = importMember<string> "material-ui/styles/colors"
or
let private _Place = importDefault<RCom> "material-ui/svg-icons/maps/place"
let place (color : string) = R.from _Place (createObj [ "color" ==> color ]) []
Hmm, may be related to #1655. Are you using any reflection in material_ui.fs like typeof<'T>.FullName? Would it be possible to share the contents of that file (maybe through a private message) so I can have a look?
@alfonsogarciacaro here you go https://gist.github.com/nilshelmig/1d8a203c89665e78d5fcf48be088ddd0
Thanks @nilshelmig! Which version of Fable.React are you using?
My current dependencies (Fable related)
Fable.Core - 2.0.3
Fable.Elmish - 2.0.3
Fable.Elmish.Browser - 2.1
Fable.Elmish.Debugger - 2.0.2
Fable.Elmish.React - 2.1
Fable.React - 4.1.3
@nilshelmig Just curiosity, do you really need the deprecated material-ui npm package? There is a fable-material-ui package with bindings for the latest @material-ui/core.
@mvsmal I know, but we are stuck to the legacy material-ui package 馃槶
Hmm, unfortunately I cannot find any hint in the code for that file 馃槙 Would it be possible to share the project somehow or create a minimal version that I can use to reproduce the problem?
If this is not possible, I can try to release a Fable version with more logs so you can run it and see if it helps to spot the error.
@alfonsogarciacaro Sharing the project is not possible, but I can run a version with additional logs for you and publish the results, if I can not find the error by myself
@alfonsogarciacaro
I've got a minimal project which reproduces the bug
https://github.com/nilshelmig/minimal-fable-bug-example
Hope this will help 馃槂
It does! Thanks a lot for this, I could finally find the cause of the problem 馃檶 and I believe I managed to fix it. I will soon publish a new fable-compiler version with the fix :+1:
It works! 馃帀 馃槂
Thank you very much
Most helpful comment
It works! 馃帀 馃槂
Thank you very much