Skip to content

laravel/vite-plugin-wayfinder is creating multiple exports with the same name #1432

@theHocineSaad

Description

@theHocineSaad

Bug description

I have a fresh Laravel app using the React starter kit, which comes with laravel/vite-plugin-wayfinder installed and configured, which is a Vite plugin for Wayfinder.

One of the things that Wayfiner does is generate importable TypeScript functions for routes, so in TypeScript, instead of doing something like href="/dashboard" we will be able to do href={dashboard()}.

It uses the name of the Laravel route to generate the TypeScript function, which is fine, but with the Tennancy for Laravel package installed, and as it is mentioned in the docs, we should add this to the web.php file:

foreach (config('tenancy.central_domains') as $domain) {
    Route::domain($domain)->group(function () {
        // your actual routes
    });
}

This will generate multiple routes with the same name (because we may have multiple central domains), and Wayfinder will create multiple exports with the same name, which is not possible in JavaScript:

Image

Steps to reproduce

  1. Create a new Laravel app and use the React starter kit.
  2. Install Tenancy for Laravel by following the Quickstart Tutorial.
  3. php artisan serve and npm run dev and visit the home page.

Expected behavior

Wayfinder should not create multiple exports with the same name.

Laravel version

12.44.0

stancl/tenancy version

3.9

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions