Passing the SCSS variable to the Svelte component
I need to create a button component that can have different colours. I would like, when using the component, to be able to specify as prop a colour e.g. "#ff0000", but also my SCSS variable e.g....
View ArticleSvelte - Unable to upload image
I am trying to upload an image and send it as a formData. However, during the binding, it is changing from File to string.Form.svelte<!-- src/components/Form.svelte --><script lang="ts">...
View ArticleClass styling on a custom component in Svelte does not register
I am using Svelte/Sapper templae and added Attractions UI, but I cannot apply any class/styles to their custom components, like so:<TextField class='search-box' type='search' /><style>...
View ArticleHow to use $lib & $env aliases from SvelteKit in Playwright?
I want to insert in database some data. My database connector is using DrizzleORM in a file named db.tssrc/lib/server/db.tsimport { connect } from "@planetscale/database";import { drizzle } from...
View ArticleProblem with package in SvelteKit when I run npm run build
I have a package that I use to share some resources between my projects.When I try to run npm run build an error is generated (I'm going to add an image).But I use this same package in another project...
View ArticleIs there a way to simplify this code avoiding to call `onDestroy` manually...
We're using EventSource in multiple places in out SvelteKit app, like this:<script> import { onDestroy } from 'svelte'; import { customEventSource } from '$lib/events'; const callback = (event:...
View ArticleWhy does JSXGraph board appear blank?
I'm running the sample JSXGraph code in Svelte, but nothing shows up. The div has the appropriate dimensions but is blank.I installed JSXGraph via npm, and in order for it to run at all without errors,...
View ArticleAdding leaflet's map.on('click', ...) in component causes SyntaxError:...
I've encountered a bit of a weird error with Leaflet and Svelte, and I'm not sure if it is my mistake or not.I have a component that encapsulates my Leaflet map, in Svelte's $lib directory. Anytime I...
View Articledocker-compose cannot access frontend app from browser
ContextI have two dockerized apps, one contains the frontend (Sveltekit) and one contains the backend API (Laravel). Both apps are on their own directory and contain separate docker-compose files....
View ArticleWhat does `svelte-kit sync` do?
I've checked the svelte-kit sync docs and the discussion around it and even tried searching Stack Overflow and asking AI.My understanding is it generates tsconfig.json and is for setting up the project...
View ArticleHow to show a loading state in sveltekit correctly?
I want to show a spinner in +layout.svelte, while the +page.js is fetching data. With the code below the navigating is not available until all api calls have finished. After the loading I see the...
View ArticleHow to trigger interactivity on individual items in an #each list in svelte 4...
I am trying to render a list of clickable items from changing api results (like an autocomplete return). The on:click is not being recognized.{#if autoCompleteResults.length > 0}<div...
View ArticleI received a warning missing-exports-condition, How do I resolve this warning?
I received a warning missing-exports-condition, any body can help me how to resolve this issue.enter image description here"@sveltejs/kit": "^2.3.2","typescript": "^5.3.3",I've follow the below step...
View ArticleSvelte invalidate() not refreshing after initial refresh
I have a button on a Svelte page listing some data. This button invokes a data endpoint to add/update a record to the database. After the database is updated, the Svelte function invalidate('URL') gets...
View ArticleHow to fix the 'Unexpected token' error in svelte js
I created the following code called "Markdown.svelte" using SvelteMarkdown to mimic ReactMarkdown.<script lang="ts"> import { SvelteMarkdown, RemarkPlugins } from "svelte-markdown"; import...
View Articlevite+svelte+pouchdb: Uncaught TypeError: Class extends value [object Object]...
I am trying to setup a bare minimum configuration using Svelte + PouchDB and running into the above error in the browser. Please see below the steps to reproduce the issue.Steps to reproduce:Create a...
View ArticleUsing Svelte, how can I prevent more than one character from displaying in an...
I'm new to Svelte, and I'm trying to implement something I've done successfully in React. I'm making a game like Wordle or a crossword puzzle in which I have several inputs, one after another, and I...
View ArticleHandling european decimal format in Svelte input component: synchronization...
I am writing an input component in Svelte. I have encountered a problem. My application is intended for the European market. In Europe, we use a comma as decimal separator.The problem is that if the...
View ArticleAuto-scrolling of parent doesn't work when child elements put into a separate...
I'm trying to add more features to my chat app. And now I try to implement auto-scrolling to the bottom of chat window when new messages appear on that window. And this piece of code works as...
View ArticleSvelte: Images loaded in batch not being called from the right build path
I have the following Svelte 4 component, with some images loaded by batch from a specific folder (and one image loaded normally just for reference):<script> import ImageThatWorks from...
View Article