Zaid-Ajaj / Feliz

A fresh retake of the React API in Fable and a collection of high-quality components to build React applications in F#, optimized for happiness
https://zaid-ajaj.github.io/Feliz/
MIT License
534 stars 78 forks source link

The module/namespace `Fable.React` from compilation unit `Fable.React` did not contain the namespace, module or type `ReactElement` #520

Closed TerenceHinrichsen closed 1 year ago

TerenceHinrichsen commented 1 year ago

When running a paket update I found myself stuck with the error per the title of the issue.

The module/namespace 'Fable.React' from compilation unit 'Fable.React' did not contain the namespace, module or type 'ReactElement'

I have updated to the to

In my paket.lock file I see the following:

 Feliz (2.0.0-prerelease-003)
      Fable.Core (>= 3.2.7)
      Fable.React.Types (>= 18.0)
      Feliz.CompilerPlugins (>= 2.0.0-prerelease-003)
      FSharp.Core (>= 4.7.2)
 Fable.React (9.1)
      Fable.React.Types (>= 18.1)
      Fable.ReactDom.Types (>= 18.0)

Although these libraries are included in my paket.lock I seem unable to reference them in my application. Do I need to specify Fable.React.Types in my paket.references file as well - or is it sufficient to have the reference to Feliz. I see there was talk about injecting the Fable.React types #509 but as far as I can see all these changes were merged - thus I suspected I would not be facing any challenges, but after trying different combinations of dependencies I am stuck.

Any advice on how I can resolve the error would be tremendously appreciated.

Zaid-Ajaj commented 1 year ago

is it sufficient to have the reference to Feliz.

That is correct, when using latet Feliz v2+, you don't have to reference Fable.React. It used to be fine to include them together but because Fable.React was a dependency of Feliz but in 2+ that is no more, they only share the Fable.React.Types dependency

TerenceHinrichsen commented 1 year ago

Thanks for the quick response and confirmation.

We must have a conflicting dependency somewhere. I updated my Fable.FontAwesome dependencies to the beta versions as well and literally have this one "build failure": The module/namespace Fable.React from compilation unit Fable.React did not contain the namespace, module or type ReactElement

The sad part is that the IDE (Rider) doesn't help me much - usually when I double-click on build error it takes me to the 'source' of the error - but here nothing ;(

I think I will start with a clean repo and add my dependencies one-by-one to see if I can find where it is failing.

mattgallagher92 commented 1 year ago

@TerenceHinrichsen did you resolve this issue? I'm facing it too when testing https://github.com/Dzoukr/SAFEr.Template

Zaid-Ajaj commented 1 year ago

@mattgallagher92 When I saw this last time, I deleted bin and obj directories, then restarted Rider. It worked afterwards. Note that dotnet clean isn't enough

mattgallagher92 commented 1 year ago

Thanks for the suggestion @Zaid-Ajaj. Unfortunately it hasn't worked for me. I'll keep digging 🙂

Zaid-Ajaj commented 1 year ago

@mattgallagher92 it would help if you could make an example repository with that doesn't work.

mattgallagher92 commented 1 year ago

Will share one later this week :+1:

TerenceHinrichsen commented 1 year ago

Sorry for only responding now, been a hectic week. @mattgallagher92 - I started from scratch, basically adding my dependencies one of the other (after updating my Paket to the latest version) and the error went away ... sorry.

mattgallagher92 commented 1 year ago

No problem @TerenceHinrichsen 🙂

@Zaid-Ajaj repro repo at https://github.com/mattgallagher92/SAFEr-fable-react-error, and more details at https://github.com/Dzoukr/SAFEr.Template/issues/13.