【问题标题】:How to correctly setup a local ReasonMl / Bucklescript dependencies如何正确设置本地 ReasonMl / Bucklescript 依赖项
【发布时间】:2020-03-27 01:08:19
【问题描述】:

ReasonML 新手,我可能不了解用于设置的 bucklescript 文档 一个模块作为依赖项。

  1. ReasonML 项目可以正确编译,文件 MyUtils.re 位于 ~/ml/myutils/src 目录中。
  2. ~/ml/project2/src 中的第二个 ReasonML 项目,文件 Demo.re 以

    开头

    打开 MyUtils;

我安装了第一个项目:我都试过了

npm install -g 

在 ~/ml/myutils 中,以及 npm install ../myutils --save 在 ~/ml/project2 里面

该模块看起来已全局安装:

 npm list -g | grep myutils

├─┬ myutils@0.1.3 -> /home/user/ml/myutils

还有本地

 npm list | grep myutils

└─┬ myutils@0.1.3 -> /home/user/ml/myutils

bsconfig.json

"bs-dependencies": [
"@glennsl/bs-json",
"myutils"

],

package.json

 "dependencies": {
"@glennsl/bs-json": "^5.0.2",
"myutils": "file:../myutils"

}

但是npm run build

We've found a bug for you!
  /home/user/ml/project2/src/Demo.re 2:6-12

  1 │
  2 │ open MyUtils;
  3 │
  4 │

  The module or file MyUtils can't be found.
  - If it's a third-party dependency:
    - Did you list it in bsconfig.json?
    - Did you run `bsb` instead of `bsb -make-world`
      (latter builds third-parties)?
  - Did you include the file's directory in bsconfig.json?

我尝试将file:../myutils 添加到 bsconfig.json:没有变化

我做错了什么?

【问题讨论】:

    标签: npm reason bucklescript


    【解决方案1】:

    @gash 去检查bsconfig.jsonmyutils。 设置"namespace": false

    如果 Myutils 命名空间是 true。它可能会为您创建额外的模块层。

    类似MyUtils.MyUtils

    【讨论】:

      猜你喜欢
      • 2019-07-10
      • 1970-01-01
      • 1970-01-01
      • 2012-11-11
      • 1970-01-01
      • 1970-01-01
      • 2021-05-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多