payloadcms/payload

Error when changing the /admin route

Closed this issue · 3 comments

Describe the Bug

I have changed the admin route in the payload.config file and admin route folder name,

Generating import map
 ⨯ node_modules\.pnpm\payload@3.0.0-beta.119_graphql@16.9.0_react-dom@19.0.0-rc-65a56d0e-20241020_react@19.0.0-rc-6_p6ukwpmaqwq4d74xehn7xkchei\node_modules\payload\dist\bin\generateImportMap\index.js (97:1) @ writeImportMap
 ⨯ Internal error: Error: Could not find the payload admin directory. Looked in C:\Users\somar\dev\apps\payload3-template\app\(payload)\admin and C:\Users\somar\dev\apps\payload3-template\src\app\(payload)\admin        
    at writeImportMap (./node_modules/.pnpm/payload@3.0.0-beta.119_graphql@16.9.0_react-dom@19.0.0-rc-65a56d0e-20241020_react@19.0.0-rc-6_p6ukwpmaqwq4d74xehn7xkchei/node_modules/payload/dist/bin/generateImportMap/index.js:109:15)
    at generateImportMap (./node_modules/.pnpm/payload@3.0.0-beta.119_graphql@16.9.0_react-dom@19.0.0-rc-65a56d0e-20241020_react@19.0.0-rc-6_p6ukwpmaqwq4d74xehn7xkchei/node_modules/payload/dist/bin/generateImportMap/index.js:93:11)
    at reload (./node_modules/.pnpm/@payloadcms+next@3.0.0-beta.119_graphql@16.9.0_next@15.0.0_react-dom@19.0.0-rc-65a56d0e-20241_tgo25dlc3kowslnl2zpbrjaisu/node_modules/@payloadcms/next/dist/utilities/getPayloadHMR.js:47:69)
    at async getPayloadHMR (./node_modules/.pnpm/@payloadcms+next@3.0.0-beta.119_graphql@16.9.0_next@15.0.0_react-dom@19.0.0-rc-65a56d0e-20241_tgo25dlc3kowslnl2zpbrjaisu/node_modules/@payloadcms/next/dist/utilities/getP    at async NotFoundPage (./node_modules/.pnpm/@payloadcms+next@3.0.0-beta.119_graphql@16.9.0_next@15.0.0_react-dom@19.0.0-rc-65a56d0e-20241_tgo25dlc3kowslnl2zpbrjaisu/node_modules/@payloadcms/next/dist/views/NotFound/index.js:48:26)
digest: "727702638"
   95 |         importMapFolderPath = path.resolve(rootDir, 'src/app/(payload)/admin/');
   96 |     } else {
>  97 |         throw new Error(`Could not find the payload admin directory. Looked in ${path.resolve(rootDir, 'app/(payload)/admin/')} and ${path.resolve(rootDir, 'src/app/(payload)/admin/')}`);
      | ^
   98 |     }
   99 |     const imports = [];
  100 |     for (const [identifier, { path, specifier }] of Object.entries(importMap)){

It seems like the admin route is hard-coded to 'src/app/(payload)/admin', please let me know if there's anything I need to do.

Thanks.

Link to the code that reproduces this issue

/

Reproduction Steps

export default buildConfig({
  routes: {
    admin: '/routename',
  },
  //..
  }

(payload) routes group
├───api
│ ├───graphql
│ ├───graphql-playground
│ └───[...slug]
└───routename
└───[[...segments]]

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

area: core

Environment Info

Binaries:
Node: 20.15.1
npm: N/A
Yarn: N/A
pnpm: N/A
Relevant Packages:
payload: 3.0.0-beta.119
next: 15.0.0
@payloadcms/db-postgres: 3.0.0-beta.119
@payloadcms/email-nodemailer: 3.0.0-beta.119
@payloadcms/graphql: 3.0.0-beta.119
@payloadcms/live-preview: 3.0.0-beta.119
@payloadcms/live-preview-react: 3.0.0-beta.119
@payloadcms/next/utilities: 3.0.0-beta.119
@payloadcms/payload-cloud: 3.0.0-beta.119
@payloadcms/plugin-cloud-storage: 3.0.0-beta.119
@payloadcms/plugin-form-builder: 3.0.0-beta.119
@payloadcms/plugin-nested-docs: 3.0.0-beta.119
@payloadcms/plugin-redirects: 3.0.0-beta.119
@payloadcms/plugin-search: 3.0.0-beta.119
@payloadcms/plugin-seo: 3.0.0-beta.119
@payloadcms/richtext-lexical: 3.0.0-beta.119
@payloadcms/storage-s3: 3.0.0-beta.119
@payloadcms/translations: 3.0.0-beta.119
@payloadcms/ui/shared: 3.0.0-beta.119
react: 19.0.0-rc-65a56d0e-20241020
react-dom: 19.0.0-rc-65a56d0e-20241020
Operating System:
Platform: win32
Arch: x64
Version: Windows 11 Home
Available memory (MB): 24389
Available CPU cores: 12

Hey @sumer-alhussein,

This looks to me like a possible duplicate of #7803 which I believe is currently being worked on.

Yeah I think that's right, closing this issue and we'll track progress in that one, thanks for reporting!

This issue has been automatically locked.
Please open a new issue if this issue persists with any additional detail.