0
0
Svelteframework~20 mins

Static adapter deployment in Svelte - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Static Adapter Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
component_behavior
intermediate
2:00remaining
What happens when you run npm run build with SvelteKit's static adapter?

Consider a SvelteKit project configured with the static adapter. You run npm run build. What is the expected output behavior?

AIt produces a client-only SPA without any server-side rendering or pre-rendered pages.
BIt creates a Node.js server bundle that serves pages dynamically at runtime.
CIt generates a fully static site with pre-rendered HTML files for each route in the <code>build</code> directory.
DIt outputs a Docker container image ready for deployment.
Attempts:
2 left
💡 Hint

Think about what a static adapter does compared to server adapters.

📝 Syntax
intermediate
2:00remaining
Which configuration snippet correctly sets up the static adapter in svelte.config.js?

Choose the correct way to import and configure the static adapter in svelte.config.js for SvelteKit.

A
import adapter from '@sveltejs/adapter-static';

export default {
  kit: {
    adapter: adapter()
  }
};
B
import staticAdapter from '@sveltejs/adapter-static';

export default {
  kit: {
    adapter: staticAdapter
  }
};
C
const adapter = require('@sveltejs/adapter-static');

export default {
  kit: {
    adapter: adapter()
  }
};
D
import adapter from '@sveltejs/adapter-static';

export default {
  kit: {
    adapter: adapter
  }
};
Attempts:
2 left
💡 Hint

Remember to call the adapter function when assigning it.

🔧 Debug
advanced
2:30remaining
Why does the static adapter fail to generate pages for dynamic routes without prerender.entries configured?

You have dynamic routes like [slug].svelte in your SvelteKit app. After building with the static adapter, those pages are missing. What is the cause?

ADynamic routes are not supported at all by the static adapter and must be removed.
BThe static adapter only pre-renders routes explicitly listed in <code>prerender.entries</code> or discovered via links; dynamic routes need manual entries.
CThe static adapter requires a special plugin to handle dynamic routes automatically.
DDynamic routes are pre-rendered by default without extra configuration.
Attempts:
2 left
💡 Hint

Think about how static generation discovers pages to build.

state_output
advanced
2:30remaining
What is the value of import.meta.env.SSR during static adapter build and runtime?

In a SvelteKit app using the static adapter, what does import.meta.env.SSR evaluate to during build and when running the static site in the browser?

AIt is <code>true</code> during build (server-side rendering) and <code>false</code> in the browser at runtime.
BIt is <code>false</code> during build and <code>true</code> in the browser.
CIt is always <code>true</code> because the app is pre-rendered.
DIt is always <code>false</code> because the static adapter disables SSR.
Attempts:
2 left
💡 Hint

Consider when SSR code runs and when client code runs.

🧠 Conceptual
expert
3:00remaining
Which deployment scenario best fits SvelteKit's static adapter?

Given these deployment environments, which one is the best fit for a SvelteKit app built with the static adapter?

AA serverless function platform that requires server-side rendering on each request.
BA Node.js server environment running the SvelteKit server for dynamic SSR.
CA Docker container running a custom Express server to serve SvelteKit pages dynamically.
DA CDN or static hosting service like Netlify, Vercel (static mode), or GitHub Pages serving pre-built HTML and assets.
Attempts:
2 left
💡 Hint

Think about what static adapter output is and where it can be hosted.