[ERROR] install ionicons in vite
i am trying to install ionicons in laravel vue vite (using package splade) npm i ionicons then i imported ionicons in resources/js/app.js
and I get an error and warning when I look in the console
Warning
Error
I've also tried using the unpkg script and it works without errors but I don't want the way to use unpkg. how to fix it? I'm still a beginner
When I used this package last year, it didn't support npm, and to this day, it doesn't seem to support it either, so you have to go with the script approach
I got progress on that. You need to import the ionicons.esm.js and ionicons.js into your HTML Template, and then it works without the Script Tag. But I haven't experimented with the vite process yet because I am usually using webpack and vite it a bit new to me.
There is no way to implement the ionicons with require or import, both of them have different issues.
So basically copying the dist files to your public folder and hotlinking them works.
<script type="module" src="/dist/ionicons/ionicons.esm.js"></script>
<script nomodule src="/dist/ionicons/ionicons.js"></script>
If there is a way to link the files with vite without running the transpiler, this should be a total win.
Hey there,
Apologies for the delay. Do you have a minimal reproduction case I could look at?
Thanks for the issue! This issue is being closed due to the lack of a reply. If this is still an issue with the latest version of Ionicons, please create a new issue and ensure the template is fully filled out.
Thank you for using Ionicons!