Closed baptiste0928 closed 3 years ago
Sadly purge icons does not support SSR either.
I don't know exactly how SSR works internally, but isn't it possible to have the bundle generated during a build phase, at the same time as the Svelte/TS compilation for example? Maybe in the specific case of Svelte, it is possible to do something with svelte-preprocess
, I will give it a look.
I have this for Vue https://github.com/antfu/vite-plugin-icons, which is purely build time and on-demanded (works for SSR). Maybe you could make a similar one for Svelte.
Thanks for the answers, I'll look into it. In the meantime I'm using the CLI which works perfectly!
Hello ! I'm currently using
@iconify/svelte
for my icons, and would like to use purge-icons to generate the bundles so that the icons are rendered in SSR. So I installed the Vite plugin as described :When I try to import
@purge-icons/generated
, an error occurs.Click to expand the error
``` TypeError: content.filter is not a function at Extract (file:///home/project-path/node_modules/@purge-icons/core/dist/index.mjs:162:29) at PurgeIcons (file:///project-path/node_modules/@purge-icons/core/dist/index.mjs:150:23) at Context.load (file:///home/project-path/node_modules/rollup-plugin-purge-icons/dist/index.mjs:21:22) at Object.load (/home/project-path/node_modules/vite/dist/node/chunks/dep-c1a9de64.js:50920:50) at transformRequest (/home/project-path/node_modules/vite/dist/node/chunks/dep-c1a9de64.js:66702:46) at async instantiateModule (/home/project-path/node_modules/vite/dist/node/chunks/dep-c1a9de64.js:73412:10) ```I looked for where this could come from, and it appears that the usage of bundles with the Svelte module is a different, but I don't know how to implement it with purge-icons:
Does anyone have any idea how to use purge-icons with SvelteKit?