Replies: 3 comments 8 replies
-
Oh interesting, we should be showing you a warning in this case about how to add support for svelte npm packages:
Are you not seeing this? |
Beta Was this translation helpful? Give feedback.
-
I am struggling importing components as well. Part of the issue for me was that the rollup plugin didn't get passed the options. I have described the problem and solution here. But I am still struggling with some components and I don't really know if this is because of my config or because the library I am trying to import is poorly configured. |
Beta Was this translation helpful? Give feedback.
-
Sorry for bumping this after a while, but I do not use rollup, just snowpack atm. I had to add installOptions: {
"packageLookupFields": ["svelte", "module", "main"]
}, to properly import svelte modules, else snowpack would not even look for a svelte field, and try main/module if it exist (and throw an error otherwise) which causes all kinds of hell for svelte. If you import svelte's compiled output into a svelte project, you get multiple svelte runtimes that do not play together. |
Beta Was this translation helpful? Give feedback.
-
Not sure if this is the correct place to raise an issue, but I'm sure it can be moved if not.
I've noticed that Snowpack's svelte support struggles if a package only has a
svelte
field, and is missing amain
field. This makes me think that Snowpack is trying to use themain
field for Svelte components.Whilst this can be worked around, the ideal scenario is to respect the
svelte
field, since some packages (one notable example being Svelte Calendar) don't use a main field at all - https://github.com/6eDesign/svelte-calendar/blob/master/package.json#L3The net result is a confusing error message about
package-name/index.js
not being found, even though that file isn't referenced anywhere. Addressing the component directlyimport Calendar from 'svelte-calendar/src/Components/Datepicker.svelte'
also doesn't appear to work (simply produces a not found error). Meaning that the library is unusable with a Snowpack project.Beta Was this translation helpful? Give feedback.
All reactions