diff --git a/assets/config.php b/assets/config.php index 25811222..7fc6c928 100644 --- a/assets/config.php +++ b/assets/config.php @@ -286,6 +286,7 @@ return [ // Stancl\Tenancy\Features\TelescopeTags::class, // Stancl\Tenancy\Features\TenantConfig::class, // https://tenancyforlaravel.com/docs/v3/features/tenant-config // Stancl\Tenancy\Features\CrossDomainRedirect::class, // https://tenancyforlaravel.com/docs/v3/features/cross-domain-redirect + // Stancl\Tenancy\Features\ViteBundler::class, ], /** diff --git a/src/Features/ViteBundler.php b/src/Features/ViteBundler.php new file mode 100644 index 00000000..e3fee2fa --- /dev/null +++ b/src/Features/ViteBundler.php @@ -0,0 +1,26 @@ +app = $app; + } + + public function bootstrap(Tenancy $tenancy): void + { + $this->app->singleton(\Illuminate\Foundation\Vite::class, Vite::class); + } +} diff --git a/tests/Features/ViteBundlerTest.php b/tests/Features/ViteBundlerTest.php new file mode 100644 index 00000000..23cf164d --- /dev/null +++ b/tests/Features/ViteBundlerTest.php @@ -0,0 +1,34 @@ +assertInstanceOf(\Illuminate\Foundation\Vite::class, $vite); + $this->assertNotInstanceOf(StanclVite::class, $vite); + + config([ + 'tenancy.features' => [ViteBundler::class], + ]); + + $tenant = Tenant::create(); + + tenancy()->initialize($tenant); + + app()->forgetInstance(\Illuminate\Foundation\Vite::class); + + $vite = app(\Illuminate\Foundation\Vite::class); + + $this->assertInstanceOf(StanclVite::class, $vite); + } +}