Fable icon indicating copy to clipboard operation
Fable copied to clipboard

v4.8.0+ fails to compile Feliz.MaterialUI or/and Feliz.MuiX.DatePickers

Open ArtemyB opened this issue 1 year ago • 4 comments

Description

When compiling a project that references Feliz.MaterialUI, Fable throws a very bloated error. Fable versions <4.8.0 compile everything fine.

Repro code

So far, I've seen the error only when I tried to compile a project that references Feliz.MaterialUI or Feliz.MuiX.DatePickers. As a ready example, the docs project in the Feliz.MaterialUI repo could be used. The steps to run it, via console, with the repo root as a working directory:

  1. dotnet restore
  2. cd ./docs-app/
  3. pnpm install
  4. pnpm start

Then, somewhere during Feliz.MaterialUI or Feliz.MuiX.DatePickers compilation, a kind of looping error will occur and clog the output. Here is a gist to the full output.

Expected and actual results

Just compile a project as it happens with Fable <=4.7.0.

Related information

  • Fable version: >= 4.8.0
  • Operating system: Windows 10 22H2

ArtemyB avatar Feb 11 '24 19:02 ArtemyB

I suppose the issue relates to the FCS update made in v4.8.0. Although I don't know what could provoke the error. I've checked Feliz.MaterialUI projects for the omission of the member keyword in static member definitions, and so for haven't found any.

ArtemyB avatar Feb 14 '24 08:02 ArtemyB

Seems like the origin of the problem is in that F# issue: https://github.com/dotnet/fsharp/issues/17415. For now, in case of Feliz.MaterialUI packages, worked around the problem by making all the big modules (with a lot of definitions) recursive, as proposed in the mentioned issue description. But in general, for other similar cases, the issue remains unsolved as long as the originating F# issue exists.

ArtemyB avatar Aug 14 '24 10:08 ArtemyB

Thanks for the information.

We will need to wait for F# team to fix the issue before we can include it in Fable. Hopefully, it will be done for F# 9

MangelMaxime avatar Aug 14 '24 16:08 MangelMaxime

Not a problem, it's already a great relief to know an actual reason and have such a simple workaround available 🙌 It was quite a luck to stumble upon the F# issue, basically a random coincidence

ArtemyB avatar Aug 14 '24 21:08 ArtemyB