Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fable F# > js compile multiple .fsx files

Tags:

f#

fable-f#

How can I compile multiple .fsx files using Fable?

I (naively) tried to just pass an array of them in the fable.config file like this:

{
    "outDir": "app",
    "projFile":["app/index.fsx", "app/testmod.fsx"],
    "sourceMaps": true,
    "targets": {
        "production": {
            "sourceMaps": false
        }
    }
}

but get the warning:

ARG ERROR: TypeError: Path must be a string. Received [ 'app/index.fsx', 'app/testmod.fsx' ]

I know I could make a full-blown .fsproj file and point the fable compiler to that but it seems like overkill to do this simply in order to add-in a reference.

It feels like I am missing something really simple?

like image 878
Stewart_R Avatar asked Oct 04 '16 12:10

Stewart_R


Video Answer


1 Answers

Well, I really was missing something simple!

The really really straightforward solution is just to use a reference in the .fsx file itself and don't worry about pointing Fable at the referenced file.

index.fsx:

module App

#load "testmod.fsx" //this reference is all thats needed!

Then we need no reference inside the fable.config:

{
    "outDir": "app",
    "projFile":"app/index.fsx",
    "sourceMaps": true,
    "targets": {
        "production": {
            "sourceMaps": false
        }
    }
}

Note to self - try the simplest solution first before posting on Stack Overflow!

like image 95
Stewart_R Avatar answered Oct 14 '22 06:10

Stewart_R