![](/img/trans.png)
[英]How to compile f# fable code to a multiple parameter javascript function
[英]Fable F# > js compile multiple .fsx files
如何使用Fable编译多个.fsx
文件?
我(天真地)试图在fable.config文件中传递它们的数组,如下所示:
{
"outDir": "app",
"projFile":["app/index.fsx", "app/testmod.fsx"],
"sourceMaps": true,
"targets": {
"production": {
"sourceMaps": false
}
}
}
但得到警告:
ARG ERROR: TypeError: Path must be a string. Received [ 'app/index.fsx', 'app/testmod.fsx' ]
我知道我可以创建一个完整的.fsproj文件,并将fable编译器指向这个,但是为了添加一个引用,这样做似乎有点过头了。
感觉我错过了一些非常简单的东西?
好吧,我真的很想念一些简单的东西!
真正非常直接的解决方案就是在.fsx
文件本身中使用引用,而不必担心将Fable指向引用的文件。
index.fsx:
module App
#load "testmod.fsx" //this reference is all thats needed!
然后我们在fable.config中不需要引用:
{
"outDir": "app",
"projFile":"app/index.fsx",
"sourceMaps": true,
"targets": {
"production": {
"sourceMaps": false
}
}
}
自我注意 - 在Stack Overflow上发布之前先尝试最简单的解决方案!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.