sveltekit Hash-based routing
I'm pretty new to svelte and especially SvelteKit. Currently, I'm working on 2 projects.The 1st one is a SPA in which I use svelte-spa-router to manage the different states and bring the ability to...
View Article+error.svelte page does not display upon server-side error detection
My files structure is this:/routes├── [slug]│├──+page.svelte├── portfolio/[slug]│├──+error.svelte│└──+page.svelte├──+error.svelte├──+layout.server.js├──+layout.svelte├──+page.svelte└──+server.jsIn...
View ArticleNested reactive state passed as a property
I have a SvelteKit app using Svelte 5. My app shows a basket, using a BasketLine component to show every product in the basket with its quantity:<script lang="ts"> interface Props { line:...
View ArticleNormalizing CSS Globally
I am building a SSG website that is using SvelteKit (v2.0.0) and Svelte (v5.0.0). I am also using PostCSS using the vitePreprocess integration.My project is the default SvelteKit project it generates...
View Articlecontrolling css order in vite dev server
I have a webpage, that loads a script from a vite dev server.so at the end of body I have this tag<script type="module" src="https://localhost:5173/index.ts"></script>In general this works...
View ArticleHow do I generate sourcemaps with Svelte and the adapter-static?
I have the following...//vite.config.jsimport { sveltekit } from '@sveltejs/kit/vite';import { defineConfig } from 'vite';export default defineConfig({ plugins: [sveltekit()], build: { sourcemap: true...
View ArticleHow to show a loading state when using a load function in SvelteKit
I have a dashboard page in the web app I am building which is pretty much wholly made up of user data. Using the load function 'seems' like the best practice for fetching this data, but from my...
View ArticlePass data from +layout.server.js to +layout.svelte and +page.svelte
I use layout.server.js to perform url checks and load other data. This data is loaded by +page.svelte. Now I want to load current url in +layout.svelte for page transition, but the data loaded (let {...
View ArticleCreating an app in tauri with a system tray and svelte frontend window
Im trying out tauri (v2) for the first time (love it), but the documentation is lacking. Im creating a frontend in svelte, and I dont want the window to close, but rather run in the background as a...
View ArticleHow to fix non-reactive nested objects inside a $state([]) in Svelte?
Here's the link to repro (Svelte Playground).The problem is that when you add a "waypoint" and toggle the checkbox to enable its bearings (thus changing the respective nested object's enabled...
View Articlesvelte 5 not updating during outro
I am in the middle of a migration from svelte 4 to svelte 5 and I've run into an issue.Previously when there was an update to a variable the component updated in response to it, even if the component...
View ArticleSvelte Custom element API
I have doubts about how to create a Custom element API. I have followed the documentation, but I get the following warning:The 'tag' option is used when generating a custom element. Did youforget the...
View ArticleOther than children(), can I import and render multiple snippets in...
New to SvelteKit and trying to figure this part out...Here's a couple of ways I was trying to achieve this, but the sidebar either doesn't load, or the navigation appears twice for some reason; with...
View ArticleGetting deprecation warnings and errors when I try to build sveltekit website
When I try to run my sveltekit project using npm run dev, I am getting errors that look like this.the deprecation warningsAfter I pull up the local host, I am also getting an error. This is a snippet...
View ArticleHow can I execute js when loading a sub route on a static build in Sveltekit
I never noticed this before, but I've encountered a weird issue in my Sveltekit application. To put it simply, I have a ("/map") sub route that when refreshed/loaded directly as the sub route won't...
View ArticleSvelte removing element not working from list of elements
I want to remove child element from list of elements based on user click, It worked well before adding custom component inside each{#each list as item}<div on:click={(event) => remove(item)}>...
View ArticleOpen Graph content not rendering correctly on Meta platforms, but works on...
I have a blog built with Django on the server and Sveltekit on the frontend.When I share a link to a blog post to Twitter, the link preview renders properly with the blog's image and title.But when I...
View ArticleHow do I return an image from my sveltekit api to the client?
I am trying to display an image from my server api to my client. I know that the server is getting the image but I am not able to send it back to the client. When I run the function I am getting the...
View ArticleHow to route programmatically in SvelteKit?
I want to be able manage history of my SvelteKit app while simultaneously making sure the whole routing system of SvelteKit doesn't get affected in any way.Something like:function routeToPage(route:...
View ArticleLeaflet: I can add class, but I can't add style to GeoJSON
I add a class to my geoJSON path with leaflet.poly = new L.GeoJSON(polyArea[0], { style:{ weight:2, opacity:1, fillOpacity:0.5, className:"poly", } }).addTo(map)The poly class is correctly added to the...
View Article