# The upstream shablon build uses rolldown with
#   { format: "iife", name: "window", extend: true }
# (see rolldown.config.js), which merges all shablon exports (store, t, watch,
# router, ...) onto the existing global `window` object. The PocketBase UI relies
# on them being plain globals (e.g. `store(...)`, `t.div(...)`), so without this
# the bundled UI throws "Uncaught ReferenceError: store is not defined".
# esbuild has no "extend" option, so instead we keep the `Shablon` global and
# merge its exports onto `window` with a footer.
esbuild index.js --bundle --outfile=dist/shablon.iife.js \
  --format=iife --global-name=Shablon --sourcemap --platform=neutral \
  --footer:js='Object.assign(window, Shablon);'
esbuild index.js --bundle --outfile=dist/shablon.es.js \
  --format=esm --global-name=Shablon --sourcemap --platform=neutral

