While this example is specifically targeting CRA users due to the added complexity, there is useful information here regardless of your setup.
First, install @rescripts/cli, @elm-react/rescripts-elm, elm and elm-webpack-loader as dev dependencies:
npm i -D @rescripts/cli @elm-react/rescripts-elm elm elm-webpack-loader
Or using yarn:
yarn add -D @rescripts/cli @elm-react/rescripts-elm elm elm-webpack-loader
update your package.json
:
"scripts": {
- "start": "react-scripts start",
+ "start": "rescripts start",
- "build": "react-scripts build",
+ "build": "rescripts build",
- "test": "react-scripts test",
+ "test": "rescripts test",
- "eject": "react-scripts eject"
},
.
.
.
+ "rescripts": [
+ "@elm-react/rescripts-elm"
+ ]
From here you should be able to follow the guide for this library! Enjoy using Elm! And be sure to check out the Elm guide if you're new!