Skip to content

Commit b874618

Browse files
authored
fix: prefer local repo build over stale cached frontend in serve command (#43)
_start_frontend() checked the cached download (~/.repowise/web/) before the local repo build. When a stale cache existed, it always served that version even though serve_command() had determined the local build was the correct one to use. Swap the priority so local builds are preferred, with the cached download as a fallback for pip-installed users.
1 parent 24be8c7 commit b874618

1 file changed

Lines changed: 10 additions & 11 deletions

File tree

packages/cli/src/repowise/cli/commands/serve_cmd.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -260,20 +260,10 @@ def _start_frontend(node: str, backend_port: int, frontend_port: int) -> subproc
260260
"PORT": str(frontend_port),
261261
}
262262

263-
# Option 1: Cached download
264-
cached_server = _WEB_CACHE_DIR / "server.js"
265-
if cached_server.exists():
266-
return subprocess.Popen(
267-
[node, str(cached_server)],
268-
cwd=str(_WEB_CACHE_DIR),
269-
env=env,
270-
)
271-
272-
# Option 2: Local repo build
263+
# Option 1: Local repo build (preferred — uses latest source)
273264
local_web = _find_local_web()
274265
if local_web:
275266
standalone_dir = local_web / ".next" / "standalone"
276-
# Next.js standalone in monorepos nests server under the package path
277267
server_js = standalone_dir / "packages" / "web" / "server.js"
278268
if server_js.exists():
279269
# Copy static files into standalone (Next.js requirement)
@@ -292,6 +282,15 @@ def _start_frontend(node: str, backend_port: int, frontend_port: int) -> subproc
292282
env=env,
293283
)
294284

285+
# Option 2: Cached download (fallback for pip-installed users)
286+
cached_server = _WEB_CACHE_DIR / "server.js"
287+
if cached_server.exists():
288+
return subprocess.Popen(
289+
[node, str(cached_server)],
290+
cwd=str(_WEB_CACHE_DIR),
291+
env=env,
292+
)
293+
295294
return None
296295

297296

0 commit comments

Comments
 (0)