Skip to content

HMR/Dev Server updates broken when using nextjs basePath #16317

@sutho91

Description

@sutho91

Describe the Bug

When running Payload on a basePath such as /cms and trying to make config changes like adding new collections or adding / updating fields, these changes are never reflected by the dev server even with a hard refresh.

Link to the code that reproduces this issue

https://github.com/sutho91/subpath-hmr

Reproduction Steps

The reproduction server is already setup to run on the basePath of /cms and setup for use with sql-lite.

  1. Start the dev server
  2. Go to http://localhost:3000/cms/admin
  3. Add a new collection or update a field on an existing collection (There is a Tags collection which is currently commented that you can just uncomment)
  4. Check to see if the change you made is reflected

If you now disable the basePath and retry the same steps, the dev server will work again as per normal.

PS. This used to work fine a while ago. Im unsure of which version of Payload this stopped working in.

Which area(s) are affected?

area: core

Environment Info

Binaries:
  Node: 24.13.0
  npm: 11.6.2
  Yarn: 1.22.22
  pnpm: 10.28.2
Relevant Packages:
  payload: 3.83.0
  next: 16.2.3
  @payloadcms/db-sqlite: 3.83.0
  @payloadcms/drizzle: 3.83.0
  @payloadcms/graphql: 3.83.0
  @payloadcms/next/utilities: 3.83.0
  @payloadcms/richtext-lexical: 3.83.0
  @payloadcms/translations: 3.83.0
  @payloadcms/ui/shared: 3.83.0
  react: 19.2.4
  react-dom: 19.2.4
Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Thu Jun  5 18:30:46 UTC 2025
  Available memory (MB): 15827
  Available CPU cores: 16

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: coreCore Payload functionalitystatus: needs-triagePossible bug which hasn't been reproduced yet

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions