Skip to content

feat(studio): add build:dev mode with source maps and React dev warnings#763

Open
vanceingalls wants to merge 1 commit into
mainfrom
feat/studio-build-dev
Open

feat(studio): add build:dev mode with source maps and React dev warnings#763
vanceingalls wants to merge 1 commit into
mainfrom
feat/studio-build-dev

Conversation

@vanceingalls
Copy link
Copy Markdown
Collaborator

Summary

  • Add build:dev script to Studio that builds with source maps, no minification, and React dev-mode warnings
  • Vite config now accepts --mode development to conditionally enable process.env.NODE_ENV, sourcemaps, and disable minify
  • CLAUDE.md updated: always use build:dev locally, production build is GHA-only

Test plan

  • bun run --cwd packages/studio build:dev produces unminified output with .map files
  • bun run --cwd packages/studio build still produces minified output without maps
  • React dev-mode warnings appear in browser console with dev build

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator

@miguel-heygen miguel-heygen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator

@jrusso1020 jrusso1020 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-form defineConfig({...}) to function-form defineConfig(({ mode }) => ({...})). Conditional spread ...(isDev && { define: {...} }) cleanly avoids leaking the define block into production. Production build retains default sourcemap: false + minify: true (the minify: !isDev evaluates to true in 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 with build:dev as 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)

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.

3 participants