S
SolidJS15mo ago
Revxrsal

vite bundling unused components from external libraries (SSR)

o/ question, i'm using https://github.com/x64Bits/solid-icons for icons and while i really like it, it seems to be including icons that i'm not using in the final build. my website is SSR'd and deployed in vercel, and it's complaining that the render function is too big. is there anything i can do to make it exclude icons i am not using?
GitHub
GitHub - x64Bits/solid-icons: The simplest way to use icons in SolidJS
The simplest way to use icons in SolidJS. Contribute to x64Bits/solid-icons development by creating an account on GitHub.
No description
18 Replies
thetarnav
thetarnav15mo ago
it should tree-shake them they are exported as separate function from what I see https://www.npmjs.com/package/solid-icons?activeTab=code
npm
solid-icons
Modern solution for use icons on SolidJS. Latest version: 1.0.12, last published: 10 days ago. Start using solid-icons in your project by running npm i solid-icons. There are 17 other projects in the npm registry using solid-icons.
thetarnav
thetarnav15mo ago
there is something wrong why is the file index.mjs as if the default is cjs
Revxrsal
RevxrsalOP15mo ago
ehh what is it supposed to be? (meant to quote the second message) also is it not tree-shaking them? because for some reason the bundle size is 7 mb 🥴
thetarnav
thetarnav15mo ago
I'm not sure what is wrong either it's how you use them (I doubt that) or the way your vite project is setup
Revxrsal
RevxrsalOP15mo ago
my vite project uses the Vercel plugin here's the project: https://github.com/Revxrsal/portfolio
Revxrsal
RevxrsalOP15mo ago
this is what vercel uses
No description
thetarnav
thetarnav15mo ago
if you build locally without the adapter, does it work fine?
Revxrsal
RevxrsalOP15mo ago
yeah, the adapter is just needed for vercel deployment
thetarnav
thetarnav15mo ago
same bundle without adapter?
Revxrsal
RevxrsalOP15mo ago
yeah. apparently its just the vercel plugin that bundles the icons for the .vercel output dir
Revxrsal
RevxrsalOP15mo ago
npm
solid-start-vercel
Adapter for Solid apps that work on Vercel.. Latest version: 0.3.5, last published: 20 days ago. Start using solid-start-vercel in your project by running npm i solid-start-vercel. There are no other projects in the npm registry using solid-start-vercel.
Revxrsal
RevxrsalOP15mo ago
i tried removing the solid-icons dependency and copy-pasting the icons i needed, and that seemed to fix the bundle size error but it created another, very weird problem https://discord.com/channels/722131463138705510/1141806554870448188/1141806554870448188 an error would appear whenever i open the page, and disappear after a simple F5 refresh
Revxrsal
RevxrsalOP15mo ago
No description
vibeman1987
vibeman198715mo ago
i think this is just a fast refresh, no?
Revxrsal
RevxrsalOP15mo ago
i thought so, but it appears on my production website 🥴 when i navigate between a page that has no icons to a page that contains icons, it appears
x64Bits
x64Bits13mo ago
Hi @Revxrsal , My builds of start, astro, cloudflare and static are only building the icons imported into the project, is it possible that it is just an adapter problem? according to this last error you mention, it was solved since 1.1.0
Revxrsal
RevxrsalOP13mo ago
I don't know, I don't think the problem occurred with the static adapter. Yeah it's probably with the vercel adapter updated solid-icons, apparently they've fixed wit SSR. issue seems to be gone. i'm really happy
x64Bits
x64Bits13mo ago
Happy to hear that! 🙌🏼
Want results from more Discord servers?
Add your server