我正在寻找一种从我的Reason React应用(名为ApplicationA)中使用本地软件包(名为bs-package)的方法。
bs-package在src文件夹中有一个名为ModuleA.re的文件:
let greet_me = (me) => Js.log("Hello, " ++ me ++ "!");
在ApplicationA中,我做了:
npm install /path/to/bs-package
在node_modules中,bs-package现在显示为符号链接。
然后将bs-package添加到bsconfig中的bs-dependencies
"bs-dependencies": [
"reason-react",
"bs-package",
],
然后在ApplicationA中运行make world
bsb -make-world
现在在我的Reason React应用中
ModuleA.greet_me("John");
给我
未绑定模块ModuleA
我想念什么?
编辑
这是bs-package的配置文件
它是使用]创建的>
bsb -init bs-package -theme basic-reson
bsconfig.json
{ "name": "bs-pacakge", "version": "0.1.0", "sources": { "dir" : "src", "subdirs" : true }, "package-specs": { "module": "commonjs", "in-source": true }, "suffix": ".bs.js", "bs-dependencies": [ ], "warnings": { "error" : "+101" }, "namespace": true, "refmt": 3 }
package.json
{ "name": "bs-pacakge", "version": "0.1.0", "scripts": { "build": "bsb -make-world", "start": "bsb -make-world -w", "clean": "bsb -clean-world" }, "keywords": [ "BuckleScript" ], "author": "", "license": "MIT", "devDependencies": { "bs-platform": "^5.0.6" } }
按照建议,bs-package已命名,因此应该可以工作
BsPackage.ModuleA.greet_me("name")
但是出现相同的错误
未绑定模块BsPackage
我正在寻找一种使用我的Reason React应用(名为ApplicationA)的本地包(名为bs-package)的方法。 bs-package在src文件夹中有一个名为ModuleA.re的文件:let greet_me =(me)= ...
显然,该错误来自我的bs平台版本。我刚刚从6.2.1版切换到7.0.1版,现在一切正常(我在Windows上)。