Replies: 4 comments 3 replies
-
This discussion reminds me a little of #3737 There is an important difference between consuming Fable compiled file and precompiled libraries. Fable compiled file cannot consume This is why precompiled libraries generates both the |
Beta Was this translation helpful? Give feedback.
-
To me it sounds more like building a solution file with multiple project in it. Perhaps that's what we want to support. But that would still be like building each project separately, so probably not what you're trying to do. |
Beta Was this translation helpful? Give feedback.
-
Have you tried moving the (dummy) "solution" project to a parent folder (to /App1, /App2 /App3), instead of a sibling folder? Not sure that helps in any way, it's probably the same. Would using some sort of bundler as post-build for each App help? |
Beta Was this translation helpful? Give feedback.
-
@DunetsNM |
Beta Was this translation helpful? Give feedback.
-
Something I came up with while working with
--precompiledLib
switch, which is the current way to optimize build time.Scenario
I have a project with three different Fable apps (each is a separate
.fsproj
file) that share a lot of code via other directly and indirectly referenced F# projects. In fact most of the code is shared (about ~700 .fs files out of 1000-1200 total for each app).All three build and released together in a single CI pipeline. I need a separate
dotnet fable
to build each of the projects. By default it'll compile each app separately from the sources, rebuilding all those ~700 shared files 3 times.To optimize build time we use precompilation as suggested in this blog post about compilation speed.
There are some downside to it though:
Experiment
While compiling an individual
.fsproj
Fable produces flat and distinct list of files and compiles them in correct order via F# compiler services.So I did a quick experiment and created a dummy project
AppsAll.fsproj
that does nothing but references all of my 3 apps projects, and tried to compile it with fable (without any precompilation!) :To my excitement Fable compiled it just fine! And much faster than compiling each app project separately - because each dependency source file was compiled only once (Fable did much better job reusing code here than I did via the precompiled lib - and did it automatically)
There's one problem: the output of this dummy project is also dumped in one directory
where Lib1 to LibN and ./fable_modules/ is the union of all dependencies of App1 , App2 and App3
I probably can just copy the output to three separate directories and tree-shake them somehow for App 1 to 3 respectively, but even if it's easy it just feels like a hack.
Idea
It'd be nice if instead of creating the dummy
.fsproj
file and doing dark magic to the output, I could just passApp1.fsproj
App2.fsproj
andApp3.fsproj
to fable in a single command line and get three separate output folders, one per app - all while compiling all F# source files only once i.e. faster (while avoiding using precompiled lib dll altogether)Beta Was this translation helpful? Give feedback.
All reactions