0
0
Svelteframework~20 mins

Adapter configuration in Svelte - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Adapter Configuration Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
component_behavior
intermediate
2:00remaining
What output does this SvelteKit adapter configuration produce?

Given this svelte.config.js snippet using the @sveltejs/adapter-static adapter, what will be the behavior when building the app?

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

export default {
  kit: {
    adapter: adapter({
      pages: 'build',
      assets: 'build',
      fallback: 'index.html'
    })
  }
};
AThe app builds a server-side rendered app with dynamic routes handled by Node.js.
BThe app builds a serverless function for each route automatically.
CThe app builds a static site without any fallback, so 404 errors occur on unknown routes.
DThe app builds a static site with fallback to index.html for SPA-style routing.
Attempts:
2 left
💡 Hint

Think about what the fallback option does in the static adapter.

📝 Syntax
intermediate
2:00remaining
Which adapter configuration syntax is correct for SvelteKit?

Choose the correct way to import and configure the @sveltejs/adapter-node in svelte.config.js.

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

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

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

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

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

Check the import style and how the adapter function is called.

🔧 Debug
advanced
2:00remaining
Why does this adapter configuration cause a build error?

Consider this svelte.config.js snippet:

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

export default {
  kit: {
    adapter: adapter({
      fallback: true
    })
  }
};

Why does this cause a build error?

AThe adapter must be imported with curly braces, not default import.
BThe <code>fallback</code> option must be a string filename, not a boolean.
CThe <code>adapter-static</code> does not support the <code>fallback</code> option.
DThe <code>kit</code> property must be a function, not an object.
Attempts:
2 left
💡 Hint

Check the expected type of the fallback option in the adapter docs.

state_output
advanced
2:00remaining
What is the effect of this adapter configuration on the build output?

Given this svelte.config.js snippet:

import adapter from '@sveltejs/adapter-vercel';

export default {
  kit: {
    adapter: adapter({
      edge: true
    })
  }
};

What does the edge: true option do?

AIt builds the app for deployment on Vercel Edge Functions for faster global response.
BIt disables server-side rendering and builds a purely static site.
CIt enables Node.js server deployment instead of edge functions.
DIt causes a build failure because <code>edge</code> is not a valid option.
Attempts:
2 left
💡 Hint

Think about what 'edge' means in cloud deployment contexts.

🧠 Conceptual
expert
2:00remaining
Which statement about SvelteKit adapter configuration is true?

Choose the correct statement about how SvelteKit adapters affect app deployment.

AAdapters automatically convert Svelte components into React components for compatibility.
BAdapters are only needed for client-side routing and have no effect on server deployment.
CAdapters transform the built app to run on specific platforms like static hosts, Node servers, or serverless functions.
DAdapters are used to configure CSS preprocessors in SvelteKit projects.
Attempts:
2 left
💡 Hint

Consider what adapters do after SvelteKit builds your app.