icons-pack / svelte-simple-icons

📦 This package provides the Simple Icons packaged as a set of Svelte components.
MIT License
53 stars 2 forks source link

Unable to use with Sapper #34

Open gleuch opened 4 years ago

gleuch commented 4 years ago

When attempting to use with Sapper, the following error is generated:

<Facebook> 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

Sapper requires the original component source in order to build for server-side rendering. See here: https://github.com/sveltejs/sapper-template#using-external-components

The current build structure for this package does not allow accessing the original component source. E.g. it does not work if installed as a dependency nor devDependency.

You may want to support Sapper-friendly exports to the uncompiled icon .svelte files within the package.

gleuch commented 4 years ago

A current workaround is to install directly from Github:

yarn add --dev https://github.com/icons-pack/svelte-simple-icons.git#v1.9.1

And then reference individual Svelte files:

<script>
  import Facebook from '@icons-pack/svelte-simple-icons/src/components/Facebook.svelte';
</script>

<Facebook size={60} />
wootsbot commented 4 years ago

@gleuch Thanks for the issue, I think we can fix it easily by making all the components available.

feel free to contribute...

wootsbot commented 1 year ago

I am performing a refactor that solves the issue.

live: https://github.com/icons-pack/svelte-simple-icons/releases/tag/v4.0.0-rc.2