Skip to main content

All Questions

0 votes
0 answers
24 views

Migrate conditional custom element compilation in Svelte Rollup config to SvelteKit Vite config

In my Svelte 3 component library I'm using this Rollup configuration to conditionally render custom elements. Only files with the *.wc.svelte extension are compiled as HTML5 web components. export ...
david's user avatar
  • 2,585
0 votes
2 answers
3k views

Rollup/Svelte is not producing chunkfiles for dynamic imports. How to make Components to lazy loadable chunks?

I want to lazy load some components in svelte. No Svelte-kit, just in pure svelte. I want to dynamically import a Svelte-Component and use it when required: const About = () => import("../...
CaspianTerrazzo's user avatar
2 votes
1 answer
3k views

importing images from svelte component library

I have created a svelte component library that has some images in it. lib └ static └ Dog_1.png this is then referenced in an image tag <img src="Dog_{Math.floor(Math.random() * 30)}.png&...
munHunger's user avatar
  • 3,061
1 vote
0 answers
275 views

Rollup with svelte not compiling $lib properly

I have a svelte-kit app I'm compiling the svelte app into one js file with rollup the problem I have is when I import a component this way : import Foo from '$lib/Foo.svelte'; rollup is not compiling ...
JuleZ's user avatar
  • 276
-1 votes
2 answers
2k views

How to import Svelte library written in TypeScript

EDIT: This question is outdated. As of 12.8.2022, svelte-kit package https://kit.svelte.dev/docs/packaging, is the recommended option. I created a library (https://github.com/TeemuKoivisto/svelte-tree-...
TeemuK's user avatar
  • 2,591
4 votes
0 answers
3k views

Can I import packages into a Svelte Component?

I'm trying to write a front-end for an app that I've built. Having just learned about Svelte, I thought it would give me reason to explore the framework further. The Svelte boilerplate that I use ...
James's user avatar
  • 211