Fable F# > js compile multiple .fsx files

戏子无情 提交于 2019-12-22 06:09:37

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!