Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Browsing all 1539 articles
Browse latest View live
↧

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 Article


Svelte - 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 Article


Class 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 Article

How 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 Article

Image may be NSFW.
Clik here to view.

Problem 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 Article


Is 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 Article

Why 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 Article

Adding 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 Article


docker-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 Article


What 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 Article

How 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 Article

How 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 Article

I 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 Article


Svelte 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 Article

How 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 Article


vite+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 Article

Using 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 Article


Handling 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 Article

Auto-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 Article

Svelte: 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
Browsing all 1539 articles
Browse latest View live