payloadcms / payloadcms/payload
HMR does not run when using turbopack and editing API route only
@AlessioGr is already working on this.
Since Feb 14, 2026.
- Dominant language
- TypeScript
- Stars
- 44.8k
- Forks
- 4.2k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 53
Description
Describe the Bug
I noticed a subtle difference in behaviour when running the dev server with and without the --turbopack flag.
For reproduction I created a small payload plugin that adds a random value to the config.custom object.
When using turbopack payload.config.custom.instanceId always returns the initial value created by the plugin, even when the config is updated after a hot reload. When using webpack payload.config.custom.instanceId changes after every hot reload.
In the reproduction repo the current state can be queried using the /api endpoint.
When using webpack:
...
"current": {
"fromConfig": "9a834d7e-2c39-4b3b-82bd-eddcc16f2f9a",
"fromConstant": "9a834d7e-2c39-4b3b-82bd-eddcc16f2f9a",
"fromGetPayload": "9a834d7e-2c39-4b3b-82bd-eddcc16f2f9a",
"fromGetPayloadCustom": "9a834d7e-2c39-4b3b-82bd-eddcc16f2f9a",
"reload": 2
},
...
All uuids are consistent after hot reload.
When using turbopack:
...
"current": {
"fromConfig": "bf7e319c-6d85-4164-a348-854646460273",
"fromConstant": "efe59d14-9ffe-4c2d-a4f7-4cfbe6df843b",
"fromGetPayload": "efe59d14-9ffe-4c2d-a4f7-4cfbe6df843b",
"fromGetPayloadCustom": "efe59d14-9ffe-4c2d-a4f7-4cfbe6df843b",
"reload": 2
},
...
Here not all uuids are consistent after triggering a hot reload.
Link to the code that reproduces this issue
https://github.com/kenneth-devedis/payload-hotreload-issue
Reproduction Steps
- Clone Repository
- Create
.envwith existing db - Repeat the following steps with
pnpm dev:turbopackandpnpm dev:webpack- Reset the reload const in
src/api/route.ts - Start the dev server
- Call
/api(curl http://localhost:3000/api) - (Recalling the api results in a unchanged response)
- Change
reloadinsrc/api/route.tsmanually to another value to trigger hot reloading - Call
/apiagain
- Reset the reload const in
- Compare the results (See Readme.md for examples)
Which area(s) are affected? (Select all that apply)
area: core
Environment Info
Binaries:
Node: 22.16.0
npm: 10.9.2
Yarn: N/A
pnpm: 10.8.0
Relevant Packages:
payload: 3.43.0
next: 15.3.0
@payloadcms/db-postgres: 3.43.0
@payloadcms/email-nodemailer: 3.43.0
@payloadcms/graphql: 3.43.0
@payloadcms/next/utilities: 3.43.0
@payloadcms/payload-cloud: 3.43.0
@payloadcms/richtext-lexical: 3.43.0
@payloadcms/translations: 3.43.0
@payloadcms/ui/shared: 3.43.0
react: 19.1.0
react-dom: 19.1.0
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 24.5.0: Tue Apr 22 19:54:49 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T6000
Available memory (MB): 32768
Available CPU cores: 10
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.