Setting Up a Svelte Project with Vite
Stryg for at vise menuen
Before building Svelte components, you need to create a real Svelte project. In this chapter, you will use Vite, a modern frontend build tool, to generate and run your first Svelte application.
What Is Vite?
Vite is a tool that helps create and run modern frontend projects. It gives you a development server, project setup, fast refresh while coding, and a production build workflow.
For this course, you do not need to understand every Vite feature yet. You only need to know that Vite helps you start and run your Svelte project quickly.
1. Creating a Svelte Project
Open your terminal and run:
npm create vite@latest my-svelte-app
Then choose:
Svelte
JavaScript
After the project is created, move into the project folder:
cd my-svelte-app
Install the project dependencies:
npm install
2. Running the Project
Start the development server:
npm run dev
Vite will show a local development URL in the terminal. Open that URL in your browser to see your first Svelte application running.
Tak for dine kommentarer!
Spørg AI
Spørg AI
Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat