寓言F#js编译多个.fsx文件 [英] Fable F# > js compile multiple .fsx files

查看:48
本文介绍了寓言F#js编译多个.fsx文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用寓言编译多个 .fsx 文件?

How can I compile multiple .fsx files using Fable?

我(天真)试图像这样在fable.config文件中传递它们的数组:

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
        }
    }
}

但得到警告:

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

我知道我可以制作一个完整的.fsproj文件,然后将寓言编译器指向该文件,但是这样做只是为了添加一个引用,似乎有点过头了.

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?

推荐答案

好吧,我确实缺少一些简单的东西!

Well, I really was missing something simple!

真正真正简单的解决方案是在 .fsx 文件本身中使用引用,而不必担心将寓言指向所引用的文件.

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!

然后,我们不需要在 fable.config:

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

注意事项-先发布最简单的解决方案,然后再发布到Stack Overflow!

这篇关于寓言F#js编译多个.fsx文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆