Skip to main content

All Questions

Tagged with
0 votes
0 answers
17 views

Sveltekit serving custom /media directory

I've set a MEDIA_ROOT variable in the .env file to a seperate folder in the file system (oustide the sveltekit app) I wanted to serve as-is for user uploads like images and such, vite just gave me an ...
Wagner's user avatar
  • 1
0 votes
1 answer
14 views

backend dependency within Svelte component library gets imported on SvelteKit (Vite/Rollup) build

I created a Svelte component library which uses better-sqlite3 for some backend methods. When building an app which uses this custom library, better-sqlite3 gets imported and bundled, causing issues ...
Bart Cuijpers's user avatar
0 votes
1 answer
58 views

Prevent svelte build from including inline script as it violates CSP

I have a svelte + typescript app. I build the app with node-adapter and hosted it with the node+express+ts backend (which also uses helmet). The build produced by Svelte contains inline script, which ...
Abhay Anand's user avatar
1 vote
1 answer
25 views

Does $env/static/public not work with custom env directories?

If I have an env file .env.development in the root directory, this works: // .env.development PUBLIC_FOO=foo // foo.svelte import { PUBLIC_FOO } from '$env/static/public'; ... console.log(PUBLIC_FOO);...
Joe's user avatar
  • 367
0 votes
0 answers
35 views

How can I use a websocket server in my production svelte-kit app?

In my current project, I need to use a websocket server (using the ws library) in my svelte-kit application. I have successfully set up the websocket server to run automatically with npm run dev (in ...
Mikachu's user avatar
  • 150
0 votes
0 answers
33 views

Vite: error 500, SyntaxError: import not found: default

Sometimes, I get a really weird thing: I get an error 500 in sveltekit like: with, in the browser, an error: The next HMR update will cause the page to reload SyntaxError: import not found: default ...
tobiasBora's user avatar
  • 2,085
0 votes
1 answer
82 views

How would you make an API call and pass data to client with Sveltekit?

I've just begun learning Sveltekit. I'm following the tutorial for Auth.js for making a custom login page (https://authjs.dev/guides/pages/signin), which passes a mapping of the providers to some ...
Jonathan Chang's user avatar
0 votes
1 answer
78 views

How to solve cache problems with npm workspaces and Vite in a monorepo

I'm using npm workspaces with Vite in a svelte project (using SvelteKit). The architecture of my project looks like this : - apps/ - project-a/ - package.json - vite.config.ts - ...
Pandorque's user avatar
  • 386
0 votes
0 answers
81 views

Are dynamic imports at runtime in the browser (ESM) possible with Svelte?

Edit: I couldn't find a way so I exported the rendering outside the library that must be provided by the user in a callback. I'm updating a Svelte component/framework library (using Vite / Sveltekit) ...
James St-Pierre's user avatar
0 votes
1 answer
79 views

Unable to dockerize a Node.js / SvelteKit app

I have a small empty SvelteKit template project which runs well locally but when I try Dockerizing it fails. Can anyone help me understand why isn't the build found? This is the Dockerfile: FROM node:...
Robert Alexander's user avatar
3 votes
1 answer
448 views

Could not convert symbol to string error after adding https certificate

I am trying to fetch data from asp.net core api to svelte page. I got a self signed certificate error: TypeError: fetch failed at node:internal/deps/undici/undici:12500:13 at process....
Ignas Karaliūnas's user avatar
1 vote
0 answers
64 views

sveltekit vite import parse error '[plugin:vite:import-analysis] Failed to parse source for import because the content contains invalid JS syntax'

I tried to develop a generic $lib module for my new sveltekit project. Getting this when trying to import a new module: [plugin:vite:import-analysis] Failed to parse source for import analysis because ...
minisaurus's user avatar
  • 1,166
0 votes
0 answers
39 views

How do I set multiple options for the server.open config in Vite.js?

How do I set multiple options for the server.open config in Vite? I want to open a specific page in Vite and also in multiple specific browsers when running npm run dev, but it seems the server.open ...
Jeffrey_0100101001100101011001's user avatar
0 votes
0 answers
24 views

Dynamic import fails on build

I have a sveltekit app which I've been trying to optimise images for. Here's some code that I use to optimise images, it uses vite dynamic import to dynamically load the image in question: ...
Jamie's user avatar
  • 168
0 votes
1 answer
117 views

Unexpected token `,`. Expected identifier or string

When I am running SvelteKit vite dev server with npm run dev I am getting error when trying to open a page: RollupError: Unexpected token `,`. Expected identifier or string at getRollupError (file:...
Mikko Ohtamaa's user avatar

15 30 50 per page
1
2 3 4 5
16