lamdera live
has rudimentary support for the elm-pkg-js spec.
Any JS in the /elm-pkg-js
folder in the project root (so /
, not /src/
!) will get included and the exports.init(app)
function called after Elm init.
i.e.
In addition to the lamdera live step, there must be a elm-pkg-js-includes.js file in root that requires all files like this:
$ cat elm-pkg-js-includes.js
// @NOTE this file will hopefully be auto-generated by elm-pkg-js in future!
// For now, its presense will mean Lamdera detects the extra JS and packages
// In future this will be more structured + restricted once the design is done
const lamdera_labs_media = require('./elm-pkg-js/lamdera-labs-media')
exports.init = async function init(app) {
// @WARNING: this only runs for Lamdera production deploys!
// This file will not run in Local development, an equivalent to this is
// automatically generated in Local Development for every file in elm-pkg-js/
lamdera_labs_media.init(app)
}
Note: the elm-pkg-js-includes.js file doesn't run locally in lamdera live
, just in prod.