Sveltekit fetch file from static folder

Viewed 1439

In sveltekit i have a static folder, in which i have .zip file, to get it locally i do something like:

const res = await fetch("/static/makeup.zip")

It works fine, but when i deployed my app i've got a 404 error

I've tried putting this file to different directories, tried different urls like: "/makeup.zip", "./static/makeup.zip", "makeup.zip"

(i think someone who knows gatsby/nuxt can help)

Where should i put this file or how the query should look like ? Thanks

2 Answers

The solution was: create folder named public and put this file into it, the request looks like this : await fetch("/makeup.zip")

What is the deployment URL?

This would grab the file from the root of the site. If your static folder is in dist,

App   
-_app   
--static

It would grab

App
-static

Also, what adapters are you using?

Related