如何.fsx使用Fable 编译多个文件?
我(天真地)试图在fable.config文件中传递它们的数组,如下所示:
{
"outDir": "app",
"projFile":["app/index.fsx", "app/testmod.fsx"],
"sourceMaps": true,
"targets": {
"production": {
"sourceMaps": false
}
}
}
Run Code Online (Sandbox Code Playgroud)
但得到警告:
ARG ERROR: TypeError: Path must be a string. Received [ 'app/index.fsx', 'app/testmod.fsx' ]
Run Code Online (Sandbox Code Playgroud)
我知道我可以做一个全面的.fsproj文件,并指出寓言编译器这一点,但它似乎像矫枉过正这样做只是为了附加的参考.
感觉我错过了一些非常简单的东西?
好吧,我真的很想念一些简单的东西!
真正非常直接的解决方案就是在.fsx文件本身中使用引用,而不必担心将Fable指向引用的文件.
index.fsx:
module App
#load "testmod.fsx" //this reference is all thats needed!
Run Code Online (Sandbox Code Playgroud)
然后我们在fable.config中不需要引用 :
{
"outDir": "app",
"projFile":"app/index.fsx",
"sourceMaps": true,
"targets": {
"production": {
"sourceMaps": false
}
}
}
Run Code Online (Sandbox Code Playgroud)
自我注意 - 在Stack Overflow上发布之前先尝试最简单的解决方案!