Skip to content

Custom Views break when admin route is set to "/" #12811

Open
@rubyjasmin

Description

@rubyjasmin

Describe the Bug

When making the admin route "/" custom views are unreachable as the forward slash is removed from path for instance "/custom-view" becomes "custom-view" which leads to 404.

Link to the code that reproduces this issue

https://github.com/rubyjasmin/custom-components-bug-reproduction

Reproduction Steps

  1. Run npx create-payload-app --example custom-components
  2. Move files inside admin to root path and modify import paths
  3. Config routes:{ admin:"/" } and importMapFile: path.resolve(dirname, "app", "importMap.js")
  4. Run app and visit /custom

Which area(s) are affected? (Select all that apply)

area: ui

Environment Info

Binaries:
  Node: 22.15.1
  npm: 10.9.2
  Yarn: 1.22.22
  pnpm: 10.11.0
Relevant Packages:
  payload: 3.42.0
  next: 15.3.3
  @payloadcms/db-postgres: 3.42.0
  @payloadcms/graphql: 3.42.0
  @payloadcms/next/utilities: 3.42.0
  @payloadcms/richtext-lexical: 3.42.0
  @payloadcms/translations: 3.42.0
  @payloadcms/ui/shared: 3.42.0
  react: 19.1.0
  react-dom: 19.1.0
Operating System:
  Platform: darwin
  Arch: x64
  Version: Darwin Kernel Version 24.5.0: Tue Apr 22 19:53:26 PDT 2025; root:xnu-11417.121.6~2/RELEASE_X86_64
  Available memory (MB): 8192
  Available CPU cores: 4

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions