FilamentF
Filament3y ago
Arko

Importing a js lib via Async Alpine

I'm loading an Alpine component asynchronously, however now my lib import doesn't work anymore:

import Tribute from "tributejs";

Gives me this error:
Uncaught (in promise) TypeError: Failed to resolve module specifier "tributejs". Relative references must start with either "/", "./", or "../".

Now tossing in the full relative path import Tribute from "../../../../node_modules/tributejs/dist/tribute.esm.js"; also doesn't work since its loaded via http, so it'd try to load this: https://my-app.test/node_modules/tributejs/dist/tribute.esm.js which obviously wouldnt work. Do I need to somehow compile this tributejs into public for this to work with async alpine?
Was this page helpful?