Loading a npm package
I have installed a package trow npm:
npm install easymde
How can I use this package in a livewire component template like this?
easyMDE = new EasyMDE({element: document.getElementById('{{$this->getName()}}')});
6 Replies
A good starting point is to read the Asset docs, and specifically the various ways of packaging / including JS assets.
Then give us a little more detail on exactly what you are trying to do, and how it relates to Filament.
https://filamentphp.com/docs/3.x/support/assets#registering-javascript-files
Yes, I read that, but in that documentation is linking a js that is in de resource path. In my case is a npm package that i install in node-modules
Usually you would import that and bundle it up
OK, so as I said, now explain in more detail exactly what you are trying to do. Like, where do you need this Javascript, what do you need to do with it.
Laracasts
Build Advanced Components for Filament
Once you're confidently building interfaces with all the components that are included with Filament, you'll likely want to begin building your own custom ones.
Hi, I'm Dan: the co-founder of Filament. This series will teach you how to build components, like custom form fields and table columns, and how to distribute them in a plugin package. Me...
Finaly I download the js and the css of the library and i include it in my files.