opencode-webui 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/server/index.ts +8 -1
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Web UI for the OpenCode coding agent — chat, streaming, tool cards, and extensions over the OpenCode engine's HTTP API.",
4
4
  "private": false,
5
5
  "type": "module",
6
- "version": "1.0.1",
6
+ "version": "1.0.2",
7
7
  "license": "MIT",
8
8
  "repository": {
9
9
  "type": "git",
package/server/index.ts CHANGED
@@ -553,7 +553,14 @@ const server: Server<Record<string, unknown>> = Bun.serve({
553
553
  }
554
554
  }
555
555
 
556
- if (Bun.env.NODE_ENV === "production") {
556
+ // Serve the built frontend when it exists (npm package + compiled binary).
557
+ // Production binaries force NODE_ENV=production via embed-shim; npm users
558
+ // get dist/ in the tarball but run with NODE_ENV unset — detect an
559
+ // installed package (no src/ on disk) vs a dev checkout (vite owns the
560
+ // frontend). Dev with a stale dist/ still goes to vite for HMR.
561
+ const hasDist = existsSync(join(DIST_DIR, "index.html"));
562
+ const isDevCheckout = existsSync(join(APP_ROOT, "vite.config.ts"));
563
+ if (Bun.env.NODE_ENV === "production" || (hasDist && !isDevCheckout)) {
557
564
  if (method === "GET" || method === "HEAD") {
558
565
  let filePath = decodeURIComponent(path);
559
566
  if (filePath === "/") filePath = "/index.html";