如何正确设置本地ReasonMl / Bucklescript依赖项

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

  1. ReasonmL项目,使用〜/ ml / myutils / src目录中的MyUtils.re文件正确编译。
  2. 〜/ ml / project2 / src中的第二个ReasonmL项目,文件Demo.re以

    开头

    打开MyUtils;

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

npm install -g 
在〜/ ml / myutils内部

npm install ../myutils-保存 里面〜/ 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中:不变

我在做什么错?

lindw1981 回答:如何正确设置本地ReasonMl / Bucklescript依赖项

@gash去检查bsconfig.json中的myutils。 设置"namespace": false

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

类似MyUtils.MyUtils

本文链接:https://www.f2er.com/2610262.html

大家都在问