Fable project fails to compile when started in parallel with a project that it shares references with.
rommsen opened this issue ยท 5 comments
A Fable project fails to compile when started in parallel with a project that it shares references with.
Example from this repo: (branch is ParallelBuildProblems
):
Fable Project: https://github.com/rommsen/ConfPlanner/blob/d4176d81035c9c7d87954783b1e046cf74db2464/src/Client/Client.fsproj#L6
Dotnetcore project:
https://github.com/rommsen/ConfPlanner/blob/d4176d81035c9c7d87954783b1e046cf74db2464/src/Server/Server.fsproj#L8
Before I referenced single files from my Domain
project in my Client
project,
Now I am referencing the whole project in both Server
and Client
The directory structure is app/src/Client
and app/src/Domain
.
When I call dotnet fable yarn-start
from app/src/Client
everything works as expected
but when I run Client
and Server
in parallel via FAKE I get all kind of errors:
ERROR in ./src/Client/Conference/State.fs C:/src/ConfPlanner/src/Client/Conference/State.fs(12,5): (12,10) error FSHARP: The namespace or module 'Model' is not defined. @ ./src/Client/State.fs 9:0-75 @ ./src/Client/App.fs @ ./src/Client/Client.fsproj
The FAKE script (build run
) looks like this:
let runDotnet workingDir args =
let result =
ExecProcess (fun info ->
info.FileName <- dotnetExePath
info.WorkingDirectory <- workingDir
info.Arguments <- args) TimeSpan.MaxValue
if result <> 0 then failwithf "dotnet %s failed" args
Target "Run" (fun _ ->
let suave = async { runDotnet serverPath "run" }
let fablewatch = async { runDotnet clientPath "fable yarn-run start" }
Async.Parallel [| fablewatch; suave |]
|> Async.RunSynchronously
|> ignore
It works when I change the line Async.Parallel [| fablewatch; suave |]
to Async.Parallel [| fablewatch|]
i.e. it works when fable and suave are not started in parallel.
It only breaks when suave and fable are started in parallel.
When I start them in different consoles everything works fine.
I am completely out of ideas.
Pinging @enricosada as discussed and @alfonsogarciacaro for completeness
As a followup: when I do not reference the Server
project anymore but only reference single files (like here in current master) everything seems to work.
To sum up
it breaks when:
Client references Server and Domain
Server references Domain
it does not break when:
Client references Domain and single files from Server
Server references Domain
Not sure if it's exactly the same issue, but it's true Fable can get confused if the same daemon is compiling two or more projects in parallel by using a Webpack file with multiple configurations. To avoid this, you can pass the extra.projectFile
option to fable-loader to help the daemon locate files belonging to different projects.
If this doesn't work, the best option is to use something like concurrently and the --port free
Fable option to start two daemons in parallel for the compilation.
Hey @alfonsogarciacaro, thanks for answering.
Maybe I am not understanding correctly but I dont think that this is the problem. I am compiling only one Fable project. This project has references to other dotnetcore (not Fable) projects (here Domain
and Server
. Server
itself has a reference to Domain
). I get the error only when I start Client
(the Fable project) and Server
in parallel.
Maybe I just dont see it but i think that this is a different case than given in the links above.
Ah, sorry, I misread the description ๐
Yes, this seems to be a different issue, but I don't know what the problem is ๐ I would need more Fable-specific info (for example, what the error message is). Please also be sure there are no port conflicts. By default Fable uses 61225 but you can specify another one with the --port
parameter.
This seems to be solved with current dotnetcore. Thanks @enricosada ๐