如何在 esy 项目中使用带 rtop 的 bucklescript 库?

How to use a bucklescript library with rtop in an esy project?

我正在尝试将 rtop 用作 esy 项目的 repl。

为此,我将 "@esy-ocaml/rtop":"*" 添加到 package.json 文件的 devDependencies 部分,并尝试使用 esy rtop 启动 rtop:

{
  ...,
  "dependencies": {
    "react": "^16.2.0",
    "react-dom": "^16.2.0",
    "reason-react": ">=0.4.0"
  },
  "devDependencies": {
    "bs-platform": "^4.0.14",
    "html-webpack-plugin": "^3.2.0",
    "webpack": "^4.0.1",
    "webpack-cli": "^3.1.1",
    "webpack-dev-server": "^3.1.8",
    "@esy-ocaml/rtop":"*"
  }
}

但是,我无法加载我的组件:

→ esy rtop
Reason # #use "./src/Component1.re";
File "./src/Component1.re", line 2, characters 5-16:
Error: Unbound module ReasonReact

Reason # #require "reason-react";
No such package: reason-react

Reason # #require "react";

Reason #

但是,如您所见,我能够加载 React,无论那是什么意思...

那么,我如何使用 rtop 作为我的项目 repl?

我也asked this in reasonml.chat回答如下

Esy doesn’t magically make bs-platform works with native toolings.

rtop is exclusively for native only and can’t be use in a bucklescript project