pathpida icon indicating copy to clipboard operation
pathpida copied to clipboard

Not working properly with Next.js Route Group

Open MorookaKotaro opened this issue 1 year ago • 0 comments

Description

When configuring the following directory structure in the app router, the object keys in $path.ts conflict. (An object literal cannot have multiple properties with the same name.)

└── app/
    ├── (withHeader)/
    │   ├── layout.tsx
    │   └── items/
    │       └── page.tsx
    └── items/
        └── [itemId]/
            └── page.tsx

Environment

  • Package version: v0.22.0
  • OS:
    • [ ] Linux
    • [ ] Windows
    • [x] macOS
  • Node.js version: v20.8.0
  • npm version: v10.1.0

Additional context

output

  "items": {
    $url: (url?: { hash?: string }) => ({ pathname: '/items' as const, hash: url?.hash, path: `/items${buildSuffix(url)}` })
  },
  "items": {
    _itemId: (itemId: string | number) => ({
      $url: (url?: { hash?: string }) => ({ pathname: '/items/[itemId]' as const, query: { itemId }, hash: url?.hash, path: `/items/${itemId}${buildSuffix(url)}` })
    })
  },

MorookaKotaro avatar Dec 19 '23 05:12 MorookaKotaro