-
Notifications
You must be signed in to change notification settings - Fork 64
Open
Description
Wayfinder Version
0.1.12
Laravel Version
12.30.1
PHP Version
8.4.12
Description
I have API routes for resources that have nested resources with the same name, e.g. folders/{id}/folders for folder structures or teams/{id}/teams for teams that have sub-teams etc.
When the route name contains the resource twice, e.g. folders.folders.index, the generated routes/folders/index.ts would contain:
const folders = {
...
folders: Object.assign(folders, folders),
}
This results in an error: Uncaught (in promise) ReferenceError: Cannot access 'folders' before initialization.
Steps To Reproduce
- Create a new Laravel 12 project with any starterkit that includes Wayfinder;
- Add a normal route like
folders.showand a nested route likefolders.folders.index:
Route::get('folders/{folder}', [FolderController::class, 'show'])->name('folders.show');
Route::get('folders/{folder}/folders', [FolderController::class, 'indexNested'])->name('folders.folders.index');
- Create a Vue page or component that includes a route:
import { show } from '@/routes/folders' - Visit the page:
Uncaught (in promise) ReferenceError: Cannot access 'folders' before initialization
Metadata
Metadata
Assignees
Labels
No labels