-
Hi to everyone! How can i add the following attribute: data-turbo-track="reload" to the scripts introduced by the @Vite directive? Regards, |
Beta Was this translation helpful? Give feedback.
Answered by
wizzymore
Aug 3, 2022
Replies: 2 comments 1 reply
-
Currently my trick for fixing this is: <?php
// app/Helpers/Vite.php
namespace App\Helpers;
class Vite extends \Illuminate\Foundation\Vite {
/**
* Generate a script tag for the given URL.
*
* @param string $url
* @return string
*/
protected function makeScriptTag($url): string
{
return sprintf('<script type="module" src="%s" data-turbo-track="reload"></script>', $url);
}
} // app/Providers/AppServiceProvider.php
/**
* Register any application services.
*
* @return void
*/
public function register()
{
$this->app->singleton(Vite::class, function () {
return new \App\Helpers\Vite();
});
} |
Beta Was this translation helpful? Give feedback.
1 reply
-
Seems like the team already added a solution to this: |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
wizzymore
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Seems like the team already added a solution to this:
https://laravel.com/docs/9.x/vite#arbitrary-attributes