How to use rtop in an esy project repl?


#1

You can also answer this question in stackoverflow: https://stackoverflow.com/questions/54043062/how-to-use-rtop-in-an-esy-project-repl

I am attempting to use rtop as repl on an esy project.

In order to do so, I have added "@esy-ocaml/rtop":"*" to the devDependencies section of my package.json file, and tried to start rtop with esy 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":"*"
  }
}

however, I am unable to load my components:

→ 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 #

but, as you can see I am able to load React, whatever that means…

Well, how can I use rtop as my project repl?


#2

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