ionicons icon indicating copy to clipboard operation
ionicons copied to clipboard

[ERROR] install ionicons in vite

Open JunedSetiawan opened this issue 2 years ago • 2 comments

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

image

and I get an error and warning when I look in the console

Warning image

Error image

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

JunedSetiawan avatar Jul 01 '23 06:07 JunedSetiawan

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

vaynevayne avatar Jul 10 '23 06:07 vaynevayne

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.

Gkiokan avatar Dec 04 '23 18:12 Gkiokan

Hey there,

Apologies for the delay. Do you have a minimal reproduction case I could look at?

liamdebeasi avatar Mar 13 '24 23:03 liamdebeasi

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!

ionitron-bot[bot] avatar Mar 27 '24 23:03 ionitron-bot[bot]