在sveltekit中导入和使用svg文件我引用了这篇文章 https://riez.medium.com/svelte-kit-importing-svg-as-svelte-component-781903fef4ae 顺便说一句,当我最后输入代码时
<svelte:component this={Logo} />
我得到如下错误
<svelte:component this={...}> is not a valid SSR component. You may need to review your build config to ensure that dependencies are compiled, rather than imported as pre-compiled modules
我希望有人能帮我解决这个问题。
最佳答案
有一个用于内联 SVG:s 的 SvelteKit 插件。您可以通过三种不同的方式使用该插件:
https://www.npmjs.com/package/@poppanator/sveltekit-svg
https://stackoverflow.com/questions/67337435/