fable-compiler / fable-react

Fable bindings and helpers for React and React Native
MIT License
275 stars 66 forks source link

error FABLE: Cannot resolve System.IO.TextWriter.Write #122

Closed nojaf closed 5 years ago

nojaf commented 5 years ago

Using 5.0.0-alpha-002

fable: Compiled .fable\Fable.React.5.0.0-alpha-002\Fable.Helpers.ReactServer.fs
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(20,13): (20,30) error FABLE: Cannot resolve System.IO.TextWriter.Write
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(21,13): (21,30) error FABLE: Cannot resolve System.IO.TextWriter.Write
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(22,13): (22,31) error FABLE: Cannot resolve System.IO.TextWriter.Write
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(23,13): (23,29) error FABLE: Cannot resolve System.IO.TextWriter.Write
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(24,13): (24,29) error FABLE: Cannot resolve System.IO.TextWriter.Write
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(25,13): (25,24) error FABLE: Cannot resolve System.IO.TextWriter.Write
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(33,2): (33,16) error FABLE: Cannot resolve System.IO.TextWriter.Write
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(34,2): (34,16) error FABLE: Cannot resolve System.IO.TextWriter.Write
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(28,2): (28,18) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(37,19)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(30,4): (30,19) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(37,19)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(28,2): (28,18) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(38,21)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(30,4): (30,19) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(38,21)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(456,82): (456,96) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(468,36)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(459,2): (459,16) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(469,33)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(460,2): (460,18) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(469,33)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(462,2): (462,16) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(469,33)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(459,2): (459,16) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(470,16)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(460,2): (460,18) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(470,16)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(462,2): (462,16) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(470,16)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(459,2): (459,16) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(471,23)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(460,2): (460,18) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(471,23)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(462,2): (462,16) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(471,23)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(459,2): (459,16) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(472,19)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(460,2): (460,18) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(472,19)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(462,2): (462,16) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(472,19)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(459,2): (459,16) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(473,16)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(460,2): (460,18) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(473,16)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(462,2): (462,16) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(473,16)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(456,82): (456,96) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(474,25)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(456,82): (456,96) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(475,27)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(459,2): (459,16) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(476,13)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(460,2): (460,18) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(476,13)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(462,2): (462,16) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(476,13)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(456,82): (456,96) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(477,22)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(456,82): (456,96) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(478,22)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(456,82): (456,96) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(479,15)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(459,2): (459,16) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(480,22)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(460,2): (460,18) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(480,22)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(462,2): (462,16) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(480,22)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(456,82): (456,96) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(481,19)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(456,82): (456,96) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(482,18)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(456,82): (456,96) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(483,17)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(459,2): (459,16) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(484,21)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(460,2): (460,18) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(484,21)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(462,2): (462,16) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(484,21)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(459,2): (459,16) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(485,21)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(460,2): (460,18) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(485,21)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(462,2): (462,16) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(485,21)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(459,2): (459,16) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(486,17)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(460,2): (460,18) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(486,17)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(462,2): (462,16) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(486,17)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(459,2): (459,16) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(487,19)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(460,2): (460,18) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(487,19)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(462,2): (462,16) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(487,19)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(459,2): (459,16) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(488,17)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(460,2): (460,18) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(488,17)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(462,2): (462,16) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(488,17)
C:/Temp/GetDark/.fable/Fable.React.5.0.0-alpha-002/Fable.Helpers.ReactServer.fs(459,2): (459,16) error FABLE: Cannot resolve System.IO.TextWriter.Write - Inline call from .(489,19)

Hmm, also the same problem with 4.1.3

nojaf commented 5 years ago

This is probably related to the fact that I'm using fable-splitter withallFiles: true. I believe it tries to compile all files in Fable.React to my output folder. Should the Fable.Helper.ReactServer.fs be wrapped with a #if !Fable directive @alfonsogarciacaro?

alfonsogarciacaro commented 5 years ago

Yes, that should be the easiest solution, would you mind to PR it? I'm concerned we're having many #if directives in the code. Probably it would be better to do like Thoth.Json does and keep two different projects for each platform. But for that we would need a comprehensive test suite to make sure the API is consistent.

nojaf commented 5 years ago

Happy to do PR. Maybe there is an other solution, is fable using the fsproj file inside the .fable folder? I'm trying to disable to compile tag with <Compile Include="Fable.Helpers.ReactServer.fs" Condition="$(FABLE_COMPILER) == 'false'" />.

This doesn't work but I'm not sure that fable looks at the proj file? Also not sure if what variables are available in msbuild.

alfonsogarciacaro commented 5 years ago

Fable does indeed look at the project file (this is necessary to get the file order) but for .fsproj coming from Nuget packages, it just does a very simplistic resolution that doesn't check conditional. But anyways #124 should solve the problem, thank you!