From c0e344d6fcf46b3e484dac48bfcad09018892a02 Mon Sep 17 00:00:00 2001 From: clawbot Date: Sat, 7 Mar 2026 14:53:13 +0100 Subject: [PATCH] Fix SPA: bundle preact instead of leaving as external require (closes #48) (#49) ## Problem The SPA fails to load with: ``` Uncaught Error: Dynamic require of "preact" is not supported ``` The esbuild config in `web/build.sh` had `--external:preact`, which tells the bundler to leave preact as a `require()` call instead of including it in the bundle. Since the browser has no `require()` function and there is no CDN/import-map loading preact externally, the app crashes immediately. ## Fix - Remove `--external:preact` from `build.sh` so preact is bundled into `app.js` - Add `--format=esm` to output proper ESM instead of IIFE with CJS require shims - Update `index.html` to use ` + diff --git a/web/src/index.html b/web/src/index.html index 282793f..13cfc93 100644 --- a/web/src/index.html +++ b/web/src/index.html @@ -8,6 +8,6 @@
- +