FilamentF
Filament16mo ago
Chris

Javascript Module Import

Hello,
I am trying to import a Javascript file from either public or resources - whichever is easier.

It appers it needs to be imported as a module, but I am seeing this error

Uncaught TypeError: Failed to resolve module specifier "filepond". Relative references must start with either "/", "./", or "../".


I have attaches some code below. Thank you for any help you may have.


In AppServiceProvider boot method

 FilamentAsset::register([
    Js::make('file-pond',url('/js/app/file-pond.js'))->module(),
        ]);


And then trying to use as follows

//
import * as FilePond from 'filepond';


window.FilePond = FilePond;


If there is a better way to access the filepond instance from blade I am also open to that.
Was this page helpful?