These posts are aggregated from Svelte GitHub Repository.

  • How to trick Svelte v5 mount() function into working?

    Hello, everyone. I have a Sveltekit project with Svelte v5. It has Vitest, jsdom and @testing-library/svelte installed and working. I can use the `render()` function from @testi
  • Is any way to type check style props which is declare in Props?

    Hi I use [Style props](https://svelte.dev/repl/f1f974410a9e4fa5a408ab8c87baa6ae?version=3.46.1) to change styling of child from parent. I declare `type Props` in script then I
  • exporting setContext with store up the component tree and re-using it in the same component

    I'm wondering if there's a best pratice to create an initialization function containing a setContext with a store, which is then executed in a component up in the comonent tree, an
  • Svelte 5: Is there a way to avoid this `$effect` using `$derived` instead?

    I have the below code: ```ts interface Props { condition?: Condition; customerId?: string; kind?: string; status?: string; } let { condition = {}, customerId, k
  • Difference between `$derived()` and `$derived.by()`?

    Since in Svelte 5 docs are present two similar runes: `$derived()` and `$derived.by()` I'm wondering what is the difference between: ```ts let test = $derived(() => {}); ```
  • How to provide more specific type for certain data attributes?

    Hello lovely people. I'm looking for a way to effectively do something like this... ```typescript // src/additional-svelte-typings.d.ts declare module 'svelte/elements' { in
  • What's the recommended pattern to perform cleanup with runes?

    I've been playing around with Svelte 5 by porting a project over, and one thing I'm not really seeing a good way to handle cleanup of side effects. For example, here's some runes c
  • Import snippet from external file

    Snippets (Svelte 5 feature) are powerful and could be better, if we could put them in an external file to be reusable. **Example:** > `my-app.snippet.svelte` or `my-app.svelt
  • What is the order of execution for Svelte preprocessors in `svelte.config.js` vs via Vite plugin?

    Hello there lovely people. As seen in [vite-plugin-svelte docs](https://github.com/sveltejs/vite-plugin-svelte/blob/45a43a4084499559a2e7a08b2403729e835fa06a/docs/faq.mdhow-do-i-ad
Loading Svelte Themes