I'm trying to get ReasonML working with an existing React code base. I'm not using create-react-app
. This is a hand-built
project. For the most part, it looks like everything is set up fine. However, I'm getting an error when I try to run Webpack with the default compiled bs.js
files.
Error: Can't resolve '../lib/js/src/ReasonReact.js'
My bsconfig.js
is almost directly copy/pasted from the ReasonML docs:
{
"name": "reason-react",
"reason": {"react-jsx" : 2},
"sources": ["src"],
"package-specs": [{
"module": "commonjs",
"in-source": true
}],
"suffix": ".bs.js",
"namespace": true,
"bs-dependencies": ["reason-react"],
"refmt": 3
}
Bucklescript is generating the appropriate bs.js
files in the location where I'd expect them. All well and good. However, I'm not surprised that Webpack can't find what it's looking for. There is no /lib/js/src/ReasonReact.js
file. There's a ReasonReact.js
file in /lib/bs
, and one in node_modules/reason-react/lib/js
.
When I edit the compiled ReasonML files, and point the ReasonReact variable to the node_modules
ReasonReact.js
file, everything works.
I've looked over several tutorials and articles. Maybe I've missed something, but I can't find anything about the error I'm encountering. Does anyone have any ideas as to why the pathing would be off in the compiled bs.js
file?