Skip to content

fix(web): transpilePackages 에 @next/third-parties 추가 (Turbopack Vercel build 회복)#611

Merged
thxforall merged 4 commits into
devfrom
fix/vercel-next-third-parties-turbopack
May 28, 2026
Merged

fix(web): transpilePackages 에 @next/third-parties 추가 (Turbopack Vercel build 회복)#611
thxforall merged 4 commits into
devfrom
fix/vercel-next-third-parties-turbopack

Conversation

@thxforall
Copy link
Copy Markdown
Contributor

Summary

Vercel build (dev/main/feature 전역) 의 `Module not found: Can't resolve '@next/third-parties/google'` 실패를 해소.

원인

Turbopack 의 subpath export 해석 회귀:

  • `@next/third-parties` 의 `package.json` exports.`./google` 가 정상 (dist/google/index.js 존재)
  • 그러나 Turbopack 이 monorepo workspace 환경에서 resolve 실패
  • 관련: vercel/next.js#58697

Fix

`packages/web/next.config.js` 의 `transpilePackages` 에 `@next/third-parties` 추가.

```js
transpilePackages: ["@decoded/shared", "@next/third-parties"],
```

Next.js 가 해당 모듈을 SWC/Turbopack 으로 transpile 하면서 subpath export 를 정상 풀어냄.

로컬 검증

```
✓ Compiled successfully in 3.0min
```

TS step 에서 별도 type error (`MagazineApprovalTable.tsx` STATUS_DOT) 노출 — 본 PR scope 외, dev base 에선 발생 안 함 (#603 back-merge 머지 후 노출 → 후속 PR 로 `generating` key 추가).

Alternatives considered

  • @next/third-parties pin (현재 next 16.2.1 ↔ third-parties 16.2.6 mismatch) → Bun 의 caret range 다른 resolve. pin 은 lockfile sync 부담.
  • next 16.2.6 minor upgrade → 영향 범위 커서 보류.

Test plan

  • Vercel preview build green
  • `bun run dev` 정상 동작 (GoogleAnalytics import 정상)
  • 다른 `@next/third-parties` 사용처 회귀 없음

🤖 Generated with Claude Code

…l build 회복)

Vercel build (dev/main/feature 전역) 가 \`Module not found: Can't resolve
'@next/third-parties/google'\` 로 실패 중. Turbopack 의 subpath export 해석
회귀이며 vercel/next.js#58697 계열로 reported.

\`transpilePackages\` 에 \`@next/third-parties\` 추가로 Turbopack 의 ESM
resolution 우회. 로컬 \`next build\` 에서 검증 (Compiled successfully in
3.0min, @next/third-parties/google 더 이상 resolve 실패 안 함).

## Why this works

\`transpilePackages\` 는 monorepo 의 workspace 가 아닌 node_modules 패키지를
대상으로도 동작, Next.js 가 해당 모듈을 SWC/Turbopack 으로 transpile 하면서
subpath export 를 정상 풀어낸다.

## Alternative considered

- @next/third-parties pin (next 16.2.1 ↔ @next/third-parties 16.2.6 mismatch)
  → caret range 가 같지만 Bun 이 다르게 resolve. pin 은 lockfile 갱신 부담.
- next 16.2.6 upgrade → minor 영향 범위 커서 보류.

## Related

- vercel/next.js#58697 — @next/third-parties module not found
- handoff session 4: dev/main/feature 전역 Vercel fail 추적

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@thxforall thxforall added the bump:patch Bug fixes / internal refactor label May 28, 2026
@vercel
Copy link
Copy Markdown

vercel Bot commented May 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
decoded-app Ready Ready Preview, Comment May 28, 2026 11:25am

…eo script

Vercel build TS step fail (\`Object literal may only specify known properties,
and 'useResearchInCopy' does not exist in type 'BuildShortFormPlanInput'\`)
해소.

\`buildShortFormPlan\` 의 \`BuildShortFormPlanInput\` type 은
\`{packet, variants, platform, durationSeconds}\` 4개만 받는다.
\`useResearchInCopy\` 는 어디서도 read 되지 않는 dead key — #592 작업 중 남은
leftover. 제거해도 동작 변화 없음.

본 PR (transpilePackages 추가) 와 함께 적용해야 Vercel build green 으로 전환.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@thxforall
Copy link
Copy Markdown
Contributor Author

Update: Real Vercel blocker identified

kiyori 가 공유한 Vercel build log 분석 결과 본 PR 의 transpilePackages workaround 는 정상 작동 (Compiled successfully in 54s). 그러나 별도 TS 에러로 차단됐었음:

./scripts/content-studio-video-local.ts:559:5
Type error: Object literal may only specify known properties, and 'useResearchInCopy'
does not exist in type 'BuildShortFormPlanInput'.

#592 의 leftover dead key 제거 commit (1c3ea4a3) 추가. dev/main/feature 전역 Vercel fail 의 진짜 원인은 이 한 줄이었음.

thxforall added a commit that referenced this pull request May 28, 2026
back-merge 로 \`MAGAZINE_STATUSES\` 에 'generating' 이 추가되면서
\`MagazineApprovalTable\` 의 \`STATUS_DOT: Record<...status, string>\` 가
key 누락으로 TS fail (확인: \`#611\` Vercel build log).

\`generating\` 상태는 blue (\`bg-blue-400\`) 로 도트 색 부여 — pending/yellow,
published/emerald, rejected/red 와 시각적 대비.

본 PR 의 back-merge 변경과 함께 적용해야 \`tsc\` green.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
이전 deployment 가 'Restored build cache from previous deployment' 로 진행되어
구 dependency state 가 잔존했을 가능성. empty commit 으로 fresh build 트리거.
Vercel Hobby plan 의 Serverless Function maxDuration 제한 (1-60s) 위반으로
배포 실패:

\`\`\`
Builder returned invalid maxDuration value for Serverless Function
\"api/v1/content/assets/video-jobs/[jobId]/compose\".
Serverless Functions must have a maxDuration between 1 and 60 for plan hobby.
\`\`\`

수정:
- \`api/v1/content/assets/video-jobs/[jobId]/compose/route.ts\`: 600 → 60
- \`api/v1/content/assets/videos/route.ts\`: 300 → 60

긴 compose/video 작업은 background job 패턴 (\`/poll\` endpoint 와 함께) 으로
처리해야 함. Vercel Pro 업그레이드 시 원래 값 복원 가능 (Pro: 800s 까지).

\#592 Video Pipeline 도입 시 누락된 Hobby 호환성 제약.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@thxforall
Copy link
Copy Markdown
Contributor Author

Update — maxDuration 60s 캡 commit (ebba59eb)

kiyori 공유 로그에서 발견:

Builder returned invalid maxDuration value for Serverless Function
"api/v1/content/assets/video-jobs/[jobId]/compose".
Serverless Functions must have a maxDuration between 1 and 60 for plan hobby.

#592 가 도입한 maxDuration = 600 (compose) / 300 (videos) 가 Vercel Hobby plan 의 1-60s 제한 위반. 60s 로 캡 적용.

함의: 긴 compose/video 작업은 background job 패턴 (poll endpoint 와 함께) 으로 처리해야 함. Pro plan (800s) 업그레이드 시 원값 복원 가능.

dev/main 전역 Vercel fail 의 진짜 원인이었음 (transpilePackages + useResearchInCopy + maxDuration 3단계 layer).

@thxforall thxforall merged commit 5c8c769 into dev May 28, 2026
6 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in decoded-monorepo May 28, 2026
@thxforall thxforall deleted the fix/vercel-next-third-parties-turbopack branch May 28, 2026 11:26
thxforall added a commit that referenced this pull request May 28, 2026
MagazineApprovalTable 과 동일 패턴 — \`STATUS_DOT: Record<MagazineStatus, string>\`
가 'generating' 키 누락으로 TS fail. blue dot 부여.

#603 로컬 빌드에서 #611 maxDuration fix 적용 후 노출된 second STATUS_DOT 위반.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bump:patch Bug fixes / internal refactor

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant