Closed dephiros closed 4 years ago
I haven't got the tooling working properly for Svelte 3 with the extension .svelte yet, thus I have kept the extension .html. Maybe that's part of the problem?
The resolve.mainFields should tell webpack to reference the source src/Icon.html instead of using index.js.
What you could do is to copy the src/Icon.html to you project and reference it as a regular svelte component (as if you written it yourself). Maybe you'll also need to change the extension to .svelte, depending on your build configuration. There's really no magic in Icon.html, just the essential.
If you figure out what need to be done to get it to work, I would be glad i you shared.
That is what i ended up doing in the mean time. Basically all I had to do to copy the component and rename to extension to svelte
and my sapper webpack setup works nicely
I'm planning on setting up a working template once all tooling works properly for svelte3. And also change the extenstion to svelte
so that it will work with webpack configured for svelte 3 "out of the box".
An alternative workaround I've found is using a relative path when importing, e.g.
import Icon from '../../node_modules/fa-svelte';
I think there might be an issue with rollup-plugin-svelte
(and potentially the webpack equivalent) where it ignores / does something weird with svelte components in node_modules
.
According to Sapper-Template Readme libraries that provides svelte components needs to be to installed as devDependencies. So solution is npm install -D fa-svelte
.
It would be great if this was mentioned in readme of this library @alphapeter .
I will clearify the readme. I've only used web pack myself, thus I've not tried it using rollup.
I have added working examples for both webpack and rollup
Hi,
Thank you for this helpful component.
I am running into this error using sapper webpack:
I checked and
svelte
is already in resolve.mainFields in webpack config so not sure what the problem is.Any help is appreciated!