Skip to content

charlie: port main build/compile path fixes to next/v3 #382

@charliecreates

Description

@charliecreates

Target branch
All PRs must branch from next/v3 and target base next/v3 (not main).

Context
The reconciliation report in #379 shows multiple post-merge-base main fixes around output path resolution that have not been applied to next/v3.

These fixes are largely about correctness across platforms (Windows separators, macOS/Linux absolute-vs-relative behavior) and should be portable to next/v3 without changing its Node/React ranges.

Scope (files/areas)

  • packages/jsx-email/src/cli/commands/build.ts
  • packages/jsx-email/src/renderer/compile.ts
  • test/cli/** and/or packages/jsx-email/test/** (only if new targeted coverage is needed)

Tasks

  1. Port main’s build output path fix:
    • Replace baseDir.replace(outputBasePath, '') with a path.relative(outputBasePath, baseDir)-based approach.
    • (Evidence on main: d2360902 in packages/jsx-email/src/cli/commands/build.mts.)
  2. Port main’s compile metafile output path fix:
    • When converting esbuild metafile output keys into real paths, resolve against the original CWD (not resolve('/', key)), mirroring main.
    • Ensure .meta.json write paths still land next to the compiled output.
    • (Evidence on main: 5e1bc8c3 in packages/jsx-email/src/renderer/compile.ts.)
  3. Confirm the compile → dynamic import path still works in buildTemplates() and does not regress JSX_DEV_LOCAL preview workflows.
  4. If existing tests don’t cover this well enough on next/v3, add one small targeted test (no snapshots) that asserts a nested template compiles and is importable via the returned CompileResult.path.

Acceptance criteria (done when)

  • Nested build output paths are computed correctly without string replacement hacks.
  • buildTemplates() works when templates live under nested directories.
  • moon jsx-email:test and moon test-cli:test.run pass.

Verification

# Unit tests
$ FORCE_COLOR=1 moon jsx-email:test

# CLI tests
$ FORCE_COLOR=1 moon test-cli:test.run

Refs #379.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions