Questions tagged [sveltekit]

[SvelteCastle]() is a powerful tool-kit designed to construct robust full-stack web applications utilizing the groundbreaking Svelte framework.

SvelteKit: Issue with missing images when running npm build

This is a straightforward SvelteKit application: <img src="static/bird.jpg" alt="a bird"/> When I use npm run dev, the image shows up just fine. However, when I execute npm run build and then npm run preview, only the alt text a ...

Best practices for resolving classlist.toggle issues with my dark mode button

The code seems to work only the first time, but after activating light mode again, the sun stops appearing. How can I ensure that the 'bi-sun' class is added back every other click or when dark mode is not activated? function theme() { document.b ...

SvelteKit - optimizing runtime configuration for remarkable production performance

Incorporating Svelte + SvelteKit for a Node.js hosted web app Is there a way to utilize the .env file or another type of configuration file when building the production version of the SvelteKit project? I have certain values that need to be adjustable dur ...

Fetch the user's email address from Auth0 using an asynchronous function

I am trying to load the user's email from Auth0 and store it in a constant. However, I am getting an arrow. I cannot identify the error. Can anyone help me find a solution? const userEmailInfo = async () => { auth0Client = await auth.createClien ...

Using Svelte to effectively connect to a specified object within an array

Check out this code snippet: <script> let data = [ {id: 1, first: "x"}, {id: 2, second: "y"} ]; </script> <input type="text" bind:value={data.first}/> If you modify the value in the input field and ...

No types are assigned to any props

I recently began working on a SvelteKit skeleton project for my personal website. However, I encountered an error when using Svelte with TypeScript - specifically, I kept getting the message Type '<some prop type>' is not assignable to type 'never'. ...

Acquiring images from an external source and storing them in either the $lib directory or the static folder during the

Currently, I have a Sveltekit project set up with adapter-static. The content for my pages is being pulled from Directus, and my images are hosted in S3, connected to Directus for easy access. I am also managing audio samples in a similar manner. During b ...

I'm facing an issue where I am unable to install packages using npm due to an ERESOLVE

Every time I attempt to add an NPM package, a recurring error message appears: npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving: @supabase/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfema ...

Having trouble creating a static site using @sveltejs/adapter-static when Bootstrape is installed

I started my project with SvelteKit by running npm create svelte@latest my-app Afterwards, I included Bootstrap in the project using npm install bootstrap. Then I imported Bootstrap's css and js files into the root layout as shown below: The content of s ...

When preparing for production, SvelteKit's Static adapter appends `.html` to href links

I am currently utilizing SvelteKit with the static adapter, and I am facing an issue. Is there a way for me to modify the <a href="/otherPage".../> so that when I execute npm run build, the href includes the .html extension? Right now, af ...