Frappe Vue/Vite changes not showing in local dev?

I have found that If you build UI in a Frappe app with Vue, Vite or webpack, you may have edited a source file, refreshed the browser, and seen nothing change.

This how iave dealt with that issue:

This happens because the browser doesn’t run your .vue or .js source. It runs a compiled bundle, which is usually in a folder like public/js/<your_ui>_dist/ and is often gitignored. The bundle only updates when you run npm run build, or when npm run dev is running as a watcher. Frappe also caches /assets/... files, so you may need a hard refresh (Cmd/Ctrl+Shift+R) as well. This is especially easy to miss when an AI coding agent such as Cursor is making the edits. It changes the source, reports success, and never rebuilds the bundle. A Cursor hook can fix this by running the build automatically after every edit. The prompt below sets one up.

Prompt to give your Cursor agent

Set up a user-level Cursor hook that automatically rebuilds JS bundles after I edit source files, for ALL my projects.
​
Requirements:
1. Create ~/.cursor/hooks/rebuild-bundles.sh (chmod +x). It reads the hook JSON from stdin and gets the edited file path from "file_path" (fall back to "path").
2. Ignore the edit unless the file ends in .vue .js .mjs .cjs .jsx .ts .tsx .css .scss .svelte. Ignore any path containing node_modules or a dist/build/out/*_dist folder.
3. Walk up from the edited file to the nearest package.json (stop at $HOME). If its scripts.build matches vite|webpack|rollup|esbuild|parcel AND a node_modules folder exists next to it, run `npm run build` in that folder. Otherwise do nothing.
4. Use a per-folder lock directory in /tmp so overlapping builds don't run, and sleep 1 second first so rapid edits settle.
5. Append the build output (last few lines) to ~/.cursor/hooks/rebuild-bundles.log. Always exit 0 (never block an edit).
6. Register it in ~/.cursor/hooks.json under "afterFileEdit" with timeout 120. Preserve any existing hooks in that file; only add the new entry. Use an absolute path for the command.
7. Verify python3 and npm are on PATH. Test by piping a fake {"file_path": "<a real source file in one of my bundle projects>"} into the script and check the log shows a successful build.
8. Tell me to restart Cursor if the hook doesn't fire, and remind me that I still need to hard-refresh the browser after a rebuild.

Cursor can’t make the browser skip its cache, so the hard refresh stays manual. Projects that build some other way, such as a Makefile or bench-only builds, won’t be picked up by the hook