Hey everyone! I just set up this extremely simple build script for cloudflare pages that I assume can be of use for others.
Assuming you have the same setup as rtfeldman’s realworld example with an index.html in root and building an elm.js file which is loaded there, you can set up a build script as follows:
#!/bin/bash ## DOWNLOAD BINARIES set -e PATH=$(pwd)/node_modules/.bin:$PATH if ! [ -x "$(command -v elm)" ]; then npm install firstname.lastname@example.org fi # It seems cloudflare pages comes with 0.19 if [[ $(elm --version) != "0.19.1" ]]; then npm install email@example.com fi ## BUILD elm make src/Main.elm --output elm.js --optimize ## CLEAN UP, cloudflare pages will reject the node_module size of >25mb rm -rf node_modules
place this in your root and enter
./build.sh as your build command in your cloudflare configuration file and voila. Hope this is useful for some.