Skip to content

charlie: port main preview deploy + asset path fixes to next/v3 #381

@charliecreates

Description

@charliecreates

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

Context
From the reconciliation report in #379, several post-merge-base main fixes around preview/deploy builds and preview static assets are not present in next/v3.

This bucket should also coordinate with (and likely subsume) the existing Windows-focused tracking issue #366.

Scope (files/areas)

  • packages/jsx-email/src/cli/commands/preview.ts
  • packages/jsx-email/src/cli/vite-static.ts
  • test/cli/** (add/port the targeted preview build-path test)

Tasks

  1. Port the main fix that normalizes glob paths passed to globby() for preview static assets:
    • In packages/jsx-email/src/cli/vite-static.ts, apply Vite-style normalizePath() to each configured glob before calling globby().
    • (Evidence on main: cb00aa67 touched packages/jsx-email/src/cli/vite-static.mts.)
  2. Align email preview --build-path behavior with main:
    • Allow relative --build-path values (resolve against the original CWD).
    • Keep absolute paths working unchanged.
    • Update help text so it no longer claims “absolute only”.
    • (Evidence on main: b7eaa939 in packages/jsx-email/src/cli/commands/preview.mts.)
  3. Port the main fix that removes Rollup externals for deployable preview builds:
    • In buildDeployable’s Vite config, do not mark react/jsx-runtime as external.
    • (Evidence on main: 0954a3d3 in packages/jsx-email/src/cli/commands/preview.mts.)
  4. Port/restore Windows drive-letter handling used by main for Vite root/build-path interactions (if still applicable in next/v3’s structure).
  5. Add/port the targeted CLI regression test from main:
    • test/cli/preview-build-path.test.ts (adapt as needed for next/v3)

Acceptance criteria (done when)

  • email preview ./templates --build-path ./.deploy works (writes output under the resolved path) and does not break absolute paths.
  • Preview static assets are served correctly when globs contain Windows path separators.
  • Deployable preview build no longer relies on react/jsx-runtime being externalized.
  • The new/ported CLI test passes.

Verification

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

# Preview-related unit tests
$ FORCE_COLOR=1 moon jsx-email:test

# Optional (if/when smoke is working again)
$ moon test-smoke: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