首页 文章

寓言F#> js编译多个.fsx文件

提问于
浏览
5

如何使用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编译器指向这个但是为了添加一个引用,这样做似乎有点过头了 .

感觉我错过了一些非常简单的东西?

1 回答

  • 8

    好吧,我真的很想念一些简单的东西!

    真正非常直接的解决方案就是在 .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上发布之前先尝试最简单的解决方案!

相关问题