Book Image

SvelteKit Up and Running

By : Dylan Hildenbrand
Book Image

SvelteKit Up and Running

By: Dylan Hildenbrand

Overview of this book

The JavaScript ecosystem has grown vast, complex, and daunting for newcomers. Fortunately, SvelteKit has emerged, simplifying the process of building JavaScript-based web applications. This book aims to demystify SvelteKit, making it as approachable as it makes web app development. With SvelteKit Up and Running you’ll be introduced to the philosophy and technologies underlying SvelteKit. First, you’ll follow a standard educational programming approach, progressing to a 'Hello World' application. Next, you’ll explore the fundamental routing techniques, data loading management, and user submission, all through real-world scenarios commonly encountered in day-to-day development, before discovering various adapters employed by SvelteKit to seamlessly integrate with diverse environments. You’ll also delve into advanced concepts like dynamic route management, error handling, and leveraging SvelteKit to optimize SEO and accessibility. By the end of this book, you’ll have mastered SvelteKit and will be well-equipped to navigate the complexities of web app development.
Table of Contents (19 chapters)
1
Part 1 – Getting Started with SvelteKit
5
Part 2 – Core Concepts
10
Part 3 – Supplemental Concepts

Configuring Vite

As previously mentioned, Vite is the build tool that makes SvelteKit possible, so it’s just as important to know how to configure Vite as it is SvelteKit. That being said, Vite is highly configurable, and so for the sake of brevity (and your attention span), we’ll keep it limited to only a high-level view of available options. This section is not intended to be an exhaustive list but rather a quick glance at the options available to you. For further reading, consult the resources located at the end of this chapter.

At its heart, SvelteKit is just a Vite plugin. Obviously, there is more to it than that, but when you open vite.config.js in a newly created SvelteKit project, you’ll see what I mean. Similar to svelte.config.js, this configuration exports a config constant, with a couple of properties set – the SvelteKit plugin that is imported and the tests to include. If you answered “no” to tests during the create@svelte prompts...