

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Still calibrating
click for more info
Not enough gems
Cost: 6 gems
1: Install TypeScript
incomplete
2: tsconfig.json
incomplete
3: More tsconfig.json
incomplete
4: Declaration Files
incomplete
5: Using JS Libraries
incomplete
6: TypeScript Language Server
incomplete
7: TypeScript Ignore
incomplete
8: Vanilla Vite
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
Okay we've built our little TypeScript script, and used tsc to compile it manually. But let's scrap all that and scaffold a front-end project using Vite.
It's quite rare these days to build a front-end application without some sort of build tool. I'm not saying you can't – we just did – I'm just saying I don't see it often in the wild. Especially considering most front-end frameworks (React, Vue, Svelte, etc.) have their own build tools.
Vite is a new(ish) build tool that focuses on speed and simplicity. It does a few key things that make it great for many projects, and even vanilla TypeScript apps:
npm i -D vite
npm create vite@latest . -- --template vanilla-ts
npm i
npm run dev
Take a look at the package.json. Notice that it has vite and typescript as dependencies now. The dev command we ran simply runs tsc to compile your code and vite to serve it, all in one step.
Press Ctrl+C in the terminal to stop the dev server when you're done.
Notice that when you update the code and save the file, Vite will automatically recompile your code and update the browser for you!
Run and submit the CLI tests.