payload generate:importmap crashes on a new Next.js app

オープン
#19,475 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@Razepriv がすでに取り組んでいます。

2026年11月13日 から。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
56/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
next.js, node.js, typescript
領域
backend, cli

調査の方向性

Start by tracing how the Payload CLI loads its bin through the bundled tsx loader and how that path loads undici's CommonJS entry. Reproduce with Node 26.9.0, Payload 3.93.0, and a payload.config.ts, then run npx payload generate:importmap. Done means the CLI completes and writes the import map without the CacheStorage constructor error.

索引モデルが issue の本文から書いたものです。

説明

area: core Bug Payload-OSS
Describe the Bug

payload generate:importmap crashes before it writes an import map. This happens on a brand-new Next.js app once payload.config.ts exists. The same crash happens on an existing app. Node was 26.9.0. Payload was 3.93.0.

TypeError: Illegal constructor
    at new CacheStorage (node_modules/undici/lib/web/cache/cachestorage.js:17:14)
    at Object.<anonymous> (node_modules/undici/index.js:177:25)
    at Object.transformer [as .js] (node_modules/tsx/dist/require-CBjy4Foe.mjs)

The Payload CLI loads its bin through the bundled tsx loader. That loader compiles undici's CommonJS entry, and CacheStorage's constructor check then throws.

next dev is a separate path. This report is only the CLI.

Link to the code that reproduces this issue

No public repository yet. Steps below create the reproduction from scratch with create-next-app and [email protected]. Happy to push that tree if a hosted repo is required.

Reproduction Steps
npx create-next-app@latest payload-next-repro --ts --tailwind --eslint --app --turbopack --use-npm --disable-git --yes
cd payload-next-repro
npm install [email protected]

Create payload.config.ts:

import { buildConfig } from 'payload'

export default buildConfig({
  collections: [],
  secret: 'test-secret',
})

Then run:

npx payload generate:importmap

Before payload.config.ts exists, the CLI starts and stops with "cannot find Payload config". After the file exists, it crashes in undici CacheStorage as shown above.

Which area(s) are affected?

area: core

Environment Info
Node.js: 26.9.0
npm: 11.19.1
next: 16.4.6
payload: 3.93.0
react: 19.3.0
OS: macOS, arm64
Package type: CommonJS (no "type": "module")
主要言語
TypeScript
スター
45.8k
フォーク
4.4k
平均マージ
3日 4時間
マージ済み PR(30日)
210

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

payloadcms/payload のほかの issue

payloadcms/payload の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。