首页 文章

如何从Fable-F中的其他文件打开模块#

提问于
浏览
2

我是Fable的新手,我在从不同文件打开自定义模块时遇到了一些问题 .

这是我的基本文件设置

node_modules
 |
public
 |
src 
 |_ App.fsx
 |_ OtherFile.fsx

在App.fsx文件中:

open CustomModule

在OtherFile.fsx文件中

module CustomModule =

    let greeting = 
        printfn "hello from CustomModule"

这是我的fableconfig.json文件:

{
    "projFile": "./src/App.fsx", 
    "outDir": "./public",
    "scripts": {
        "postbuild": "./node_modules/.bin/webpack"
    }

}

每当我尝试引用CustomModule时,都会收到 The namespace or module 'CustomModule' is not defined. 错误 . 有任何想法吗?

1 回答

  • 0

    原来有一个类似的问题here,他的答案解决了我的问题 .

    只需调用以下内容即可加载其他模块

    #load "OtherFile.fsx"
    

相关问题