Skip to content
Discussion options

You must be logged in to vote

Hello,
php artisan filament:assets only copies the selected file to the public directory. However, if you use import statement in your JavaScript code, it will not work.

Solution

You need to run the Vite build process first:

npm run build

Use Vite::asset() to get the URL of the compiled asset:

<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Filament\Support\Facades\FilamentAsset;
use Illuminate\Support\Facades\Vite;
use Filament\Support\Assets\Js;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     */
    public function register(): void
    {
        //
    }

    /**
     * Bootstrap any application servi…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by danielh-official
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants