Skip to content
Advertisement

Tag: sveltekit

How to generate a static website out of Sveltekit official RealWorld example for hosting on google firebase?

https://realworld.svelte.dev/ is the official example of SvelteKit. https://github.com/sveltejs/realworld is the codebase for this official example. I am trying to generate a static site so I can host this on google firebase. I updated config asĀ  content of file svelte.config.js is Content of file src/routes/+layout.server.js is When I am trying to build using command npm run build I am getting error

Calling array object in src does not work

I have an array : I am looping in it: This here does not work: src={icon} Correct way should be like this: If I replace the {icon} with string it works! Can someone tell me why? Thank you Answer The reason this doesn’t work is because <Icon src=”xxx” /> does not expect a string but an object. If you import

Svelte SPA Router – Invalid component object error

I’m using SvelteKit and svelte-spa-router. My file structure looks like the following: __layout.svelte: (As per the example in the link above.) Error: Console: If I remove <Router {routes} /> and use <slot></slot>, everything works fine. The only thing I managed to find about this error was this GitHub source code of Router.svelte (line #301), but it didn’t help much. I

How can I get the access of a const inside my function?

How can I grant access to my const to be used inside a function? In this case I want to access my const catName inside my function fetchListings. I’m getting this error: Question Updated: Answer The problem you are running into is coming from how the <script context=”module”> works. The module level script tag serves as a one-time-per-app setup script.

Advertisement