Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

rahul_singh_codoffer's avatar

Add custom script in filament v2.0.*

I want to add the uppy file uploader in my blade. i have created an script for it it will import the uppy from CDN and show the uppy dashboard and upload file via the tus. but i have to add this script as a module. and in filament i'm unable to do this . it's giving me the error SyntaxError: Cannot use import statement outside a module

my blade looks like a : -

const uppy = new Uppy()
uppy.use(Dashboard, {
    target: '#uppy'
    , inline: true
})

uppy.use(Tus, {
    endpoint: END_POINT
    , headers: {
        Authorization: `Bearer AUTH_TOKEN`
    , }
    , retryDelays: [0, 3000, 6000, 12000, 24000]
    , chunkSize: 52428800
    , onAfterResponse: function(request, response) {
        console.log(response);
        this.cfVideoId = response.getHeader('stream-media-id');
        console.log(this.cfVideoId);
    }
, });

uppy.on('complete', (result) => {
    console.log(result);
});

Action::make('Upload help video')->action(function (array $data): void { })->modalContent(view('widgets.uppy', ['help_article_id' => $help_article_id])) ->modalButton('Done'),

0 likes
0 replies

Please or to participate in this conversation.