Skip to content

Fix: build the SPA on install so /draw isn't 'Page not found'#21

Merged
vibhavkatre merged 1 commit into
mainfrom
fix/build-spa-on-install
Jul 20, 2026
Merged

Fix: build the SPA on install so /draw isn't 'Page not found'#21
vibhavkatre merged 1 commit into
mainfrom
fix/build-spa-on-install

Conversation

@vibhavkatre

Copy link
Copy Markdown
Collaborator

The bug (reported by @asoral)

Visiting <site>/draw on a fresh install returns Frappe's "Page not found."

Root cause

The SPA's outputs — draw/www/draw.html and draw/public/frontend/ — are git-ignored build artifacts produced by yarn build (via the frappe-ui vite plugin's buildConfig). The app had no root-level package.json, so nothing ran that build during install/deploy. A fresh bench get-app draw (or Frappe Cloud deploy) therefore had no www/draw.html at all, and /draw had nothing to serve → 404.

Fix

Add a root package.json mirroring the pattern every Frappe SPA app uses (Drive, Helpdesk, Gameplan, Insights):

{
  "scripts": {
    "postinstall": "cd frontend && yarn install",
    "build": "cd frontend && yarn build"
  }
}

bench build — run on every Frappe Cloud deploy and self-hosted install — now invokes the app's build script and generates the SPA.

Verified

From a clean tree with both artifacts deleted (simulating a fresh clone):

  • bench build --app draw → regenerates www/draw.html + public/frontend/assets/* and /draw serves again. ✅

This also makes Frappe Cloud installs turnkey.

🤖 Generated with Claude Code

The Vue SPA's two outputs — www/draw.html and public/frontend/ — are git-ignored
build artifacts generated by `yarn build` (the frappe-ui vite plugin's buildConfig
writes both). Nothing triggered that build on install, because the app had no
root-level package.json. So a fresh `bench get-app draw` / Frappe Cloud deploy had
NO www/draw.html at all, and visiting <site>/draw returned Frappe's "Page not
found" 404 (reported by @asoral).

Fix: add a root package.json mirroring the pattern every Frappe SPA app uses
(drive, helpdesk, gameplan, insights) —

  postinstall: cd frontend && yarn install   # bench pulls frontend deps
  build:       cd frontend && yarn build      # bench build compiles the SPA

`bench build` (run on every Frappe Cloud deploy and self-hosted install) now runs
the app's build script, generating www/draw.html + assets. Verified: from a clean
tree (both artifacts deleted) `bench build --app draw` regenerates the SPA and
/draw serves again.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Jul 20, 2026

Copy link
Copy Markdown

Confidence Score: 5/5

Single-file addition that wires up the standard Frappe SPA build hook; no logic changes, no risk of regression.

This adds exactly one file with three scripts that delegate to the existing frontend build. The pattern is battle-tested across multiple Frappe apps, and the change has no effect on any existing code path.

No files require special attention.

Reviews (1): Last reviewed commit: "Fix: build the SPA on install/deploy so ..." | Re-trigger Greptile

@vibhavkatre
vibhavkatre merged commit 54c484f into main Jul 20, 2026
3 checks passed
@vibhavkatre
vibhavkatre deleted the fix/build-spa-on-install branch July 20, 2026 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants