feat(studio): add build:dev mode with source maps and React dev warnings#763
feat(studio): add build:dev mode with source maps and React dev warnings#763vanceingalls wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
miguel-heygen
left a comment
There was a problem hiding this comment.
Clean approach — converting defineConfig to the function form for mode-conditional behavior is the right call. Source maps + no minification + React dev warnings for local builds will make debugging significantly easier.
One note: process.env.NODE_ENV define is only set for dev mode, which is correct — Vite already handles this for production builds via its default behavior.
File size check / Windows CI failures are pre-existing and unrelated to this change.
LGTM.
— Magi
jrusso1020
left a comment
There was a problem hiding this comment.
Verdict: COMMENT — clean dev-build addition; gated on hf#750 for CI green
Per Rule 5: pulled check_runs at 2f7fcbf3 — File size check is RED, same pre-existing 11-grandfathered-studio-files issue hf#750 is solving. None of this PR's 3 changed files are >500 LOC. Windows tests also red (pre-existing on main per the prior hf#750 review trail). All other required Linux checks green (Lint, Build, Test, Typecheck, CLI smoke, regression, preview-regression, Smoke: global install, Format, CodeQL).
Same disposition as hf#755 earlier today: code-level approvable, practically blocked behind hf#750.
Audited
All 3 files end-to-end. Mechanic checks out:
-
vite.config.ts— refactor from object-formdefineConfig({...})to function-formdefineConfig(({ mode }) => ({...})). Conditional spread...(isDev && { define: {...} })cleanly avoids leaking thedefineblock into production. Production build retains defaultsourcemap: false+minify: true(theminify: !isDevevaluates totruein non-dev mode). No sourceMappingURL leak risk in deployed assets. ✓ -
package.json— adds"build:dev": "vite build --mode development". Single line. ✓ -
CLAUDE.md— adds a "Studio Build" subsection withbuild:devas the local default, production build as GHA-only, plus a post-build copy command. Reasonable workflow guidance.
One observation (non-blocking)
The dev build's process.env.NODE_ENV = "development" is set via define, which means React picks up dev-mode warnings at runtime. Worth verifying that the studio code doesn't have any branches keyed off process.env.NODE_ENV that change behavior beyond "show extra warnings" — e.g., enabling expensive dev-only invariant checks. Probably fine but worth a quick grep "process.env.NODE_ENV" packages/studio/src to confirm no surprises hidden behind dev-mode conditionals.
Why COMMENT, not APPROVE
The File size check is failing because the studio package still has 11 pre-existing >500 LOC files (the hf#750 allowlist hasn't merged yet). This PR doesn't touch any of those files — the failure is environmental, not introduced here. Once hf#750 lands → rebase → File size check goes green → clean APPROVE.
If hf#750 doesn't merge soon, the alternative is a cherry-pick of its .filesize-allowlist onto this branch. But the cleaner path is just to wait.
Review by Rames Jusso (pr-review)
Summary
build:devscript to Studio that builds with source maps, no minification, and React dev-mode warnings--mode developmentto conditionally enableprocess.env.NODE_ENV, sourcemaps, and disable minifybuild:devlocally, production build is GHA-onlyTest plan
bun run --cwd packages/studio build:devproduces unminified output with.mapfilesbun run --cwd packages/studio buildstill produces minified output without maps🤖 Generated with Claude Code