问题
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?
回答1:
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!
来源:https://stackoverflow.com/questions/39852639/fable-f-js-compile-multiple-fsx-files