Lovely targets LÖVE >= 11 web builds. The current strategy is to keep the CLI runtime-agnostic while collecting proven love.js fixes into a managed web runtime profile.
Useful compatibility patches:
- Prefer
table.unpackoverunpackfor Lua 5.2+. - Provide a
bitcompatibility alias backed bybit32when available. - Choose a supported canvas format before calling
love.graphics.newCanvas. - Hoist user-defined vertex shader
varyingdeclarations before generated shader code for WebGL implementations that reject late declarations. - Avoid old
love.audio.play/stop/pausemodule functions on affected Emscripten builds; preferSource:play/stop/pause.
Lovely-side implications:
- Add future diagnostics for
unpack(,require("bit"), module-level audio calls, and shader code with custom varyings. - Consider an optional Lua web shim injected into
.lovearchives only when a project opts in.
Linked commits grouped by runtime concern:
c85e151: Emscripten 2.0.34 support, mobile keyboard hooks,Module._mallocinstead of deprecatedModule.getMemory, IDBFS safety patches, generated worker/runtime refresh.8e98713: partial canvas resize support through CSS sizing, resize events,Module.setCanvasSizewhen available, and documented limitations.b92f5e1: fullscreen API corrections plus mobile CSS fullscreen fallback.c76c5f5: responsive mobile layout refinements, loading canvas sizing, and better fullscreen styling.
Lovely.js-side implications:
- Keep the runtime-owned shell responsive and mobile-aware.
- Bundle
lovely-game-loader.js,lovely-web-shims.js, and the defaultindex.htmltemplate besidelove.jsandlove.wasm. - Treat mobile keyboard support as two phase: runtime/native hook calls a global JavaScript function; JavaScript focuses a hidden input during the next touch gesture so mobile browsers allow the keyboard.
- Do not blindly vendor generated
.wasmor generated Emscripten JavaScript from forks. Track the source-level fixes separately from generated artifacts. - If Lovely eventually owns a runtime fork, patch IDBFS at build time or disable it by configuration rather than manually editing generated output.
Web builds now emit or copy:
index.htmllovely-game-loader.jsandlovely-web-shims.jsfrom the selected Lovely.js runtime bundle- runtime files such as
love.js,love.wasm, and optional worker/theme files game.lovelovely-runtime.txt
targets.web.arguments configures game launch arguments for love.js builds.
Lovely writes Module.arguments as ["./game.love", ...arguments], so a demo
web deployment can set arguments = ["--demo-capture"]. Custom web templates
can use __GAME_TITLE__, __WEB_ARGUMENTS__, and __WEB_MEMORY__
placeholders. Files referenced by a custom template, such as logos or fonts,
belong in targets.web.html_assets; file entries are copied beside
index.html, and directory entries are copied under their directory name. If
targets.web.html_template is unset and the selected runtime bundle contains
lovely-runtime.json, Lovely reads the bundle's html field and renders that
template as dist/web/index.html.
By default, lovely build web resolves the managed Lovely.js runtime bundle
from targets.web.variant. For patched or project-pinned web runtimes, set
targets.web.runtime_path to a project-relative Lovely.js runtime bundle
directory. This lets lovely build web include runtime files directly from the
game repository or restored release artifact without a separate
lovely runtime fetch setup step.
If the configured path points at a missing lovely.js/dist/<variant> checkout,
or if no runtime_path is configured and no cached runtime exists, Lovely
restores the Lovely.js repository, runs npm ci/npm run build, and uses the
generated bundle. CI can set LOVELY_JS_REF to pin the checkout ref or
LOVELY_JS_PATH to use an already-restored checkout. The global runtime cache
remains useful for shared machine-local tooling, while runtime_path remains an
escape hatch for release repos that need an explicitly vendored runtime bundle.
When Lovely starts building or distributing a managed love.js-derived runtime, fold in these items in order:
- Source-level Emscripten compatibility:
Module.getMemorytoModule._malloc- CMake policy/version updates needed by the selected Emscripten release
- Browser shell improvements:
- responsive canvas sizing
- fullscreen API fallback matrix
- mobile CSS fullscreen fallback
- mobile keyboard bridge
- Filesystem policy:
- decide whether IDBFS is enabled by default,
- if enabled, include safety checks for undefined file contents,
- expose persistence as an explicit Lovely config option.
- Lua compatibility shims:
bit/bit32- canvas pixel format fallback
- shader varying hoist
- Lua 5.1/5.2 library differences
- Test matrix:
- desktop Chrome/Firefox/Safari,
- iOS Safari,
- Android Chrome,
- Itch iframe/embedded page,
- threaded builds with cross-origin isolation headers.