[{"id":"vitebeginner-001","courseId":"vite-beginner","domain":"dev-server-and-hmr","topic":"Dev server startup","prompt":"A teammate has just cloned a Vite project and wants to start the development server from the project folder. Which command does that?","hint":"One subcommand starts a server rather than producing output.","explain":"The command line has several subcommands. Some produce files for release, some serve already-made output, and one runs a live server while you edit code.","source":"https://vite.dev/guide/cli","interaction":{"type":"single"},"options":[{"id":"a","text":"vite build","whyNot":"That subcommand builds the app for production; it doesn't start a server."},{"id":"b","text":"vite preview","whyNot":"That serves an already built production output locally, so it needs a build first."},{"id":"c","text":"vite dev","why":"The dev subcommand starts the dev server in the current directory, just like plain vite does."},{"id":"d","text":"vite optimize","whyNot":"That pre-bundles dependencies; it is deprecated because that step already runs automatically."}],"answer":"c","explanation":"Plain vite, vite dev and vite serve are aliases that start the dev server in the current directory; build and preview handle production output.","concept":"Plain vite, vite dev and vite serve are aliases that start the dev server in the current directory; build and preview handle production output.","rev":1,"updatedAt":"2026-10-26","kind":"scenario","takeaways":["Plain vite, vite dev and vite serve all start the dev server in the current directory."]},{"id":"vitebeginner-002","courseId":"vite-beginner","domain":"dev-server-and-hmr","topic":"Default dev server port","prompt":"You start Vite in a new project and change no settings. Which port does the dev server listen on?","hint":"Look for the default value of the port setting in the server options.","explain":"A server listens on a numbered port, and each tool ships with a default number that you can change in its settings. Tool authors pick these defaults, so they differ between tools.","source":"https://vite.dev/config/server-options","interaction":{"type":"single"},"options":[{"id":"a","text":"3000","whyNot":"3000 is a common default in other tools, but Vite doesn't use it."},{"id":"b","text":"5173","why":"The server.port setting defaults to 5173 for the dev server."},{"id":"c","text":"8080","whyNot":"8080 is a popular alternative port, but it is not Vite's default."},{"id":"d","text":"4200","whyNot":"4200 is the default of a different framework's tooling, not of Vite."}],"answer":"b","explanation":"server.port defaults to 5173 for the dev server; if that port is already in use, Vite tries the next available one.","concept":"server.port defaults to 5173 for the dev server; if that port is already in use, Vite tries the next available one.","rev":1,"updatedAt":"2026-10-26","kind":"scenario","takeaways":["The dev server's default port is 5173, set by server.port."]},{"id":"vitebeginner-003","courseId":"vite-beginner","domain":"dev-server-and-hmr","topic":"index.html as entry point","prompt":"Put these steps for setting up a plain Vite project by hand in order.","hint":"Each step needs something the step before it produced.","explain":"Setting up a small app by hand is a short chain of stages. Each stage depends on something an earlier stage put in place.","source":"https://vite.dev/guide/","interaction":{"type":"sort","items":[{"text":"Install vite as a dev dependency with your package manager","why":"The vite command has to exist in the project before anything can run it."},{"text":"Create an index.html file in the project root","why":"This file is the entry point the dev server reads and serves."},{"text":"Run the vite command in your terminal","why":"This starts the dev server, which then has a page to serve."},{"text":"Visit http://localhost:5173 in your browser","why":"The index.html is served on that address once the server is running."}]},"options":[],"answer":"o:abcd","explanation":"The guide's manual setup goes: install the vite package, create index.html in the project root, run the vite CLI, then open the address it serves.","concept":"The guide's manual setup goes: install the vite package, create index.html in the project root, run the vite CLI, then open the address it serves.","rev":1,"updatedAt":"2026-10-26","kind":"scenario","takeaways":["A plain Vite project needs the vite package, an index.html, and the vite command."]},{"id":"vitebeginner-004","courseId":"vite-beginner","domain":"dev-server-and-hmr","topic":"Native ESM in dev","prompt":"A large app has hundreds of source files. A bundler would pack the whole app before serving it. When you open a page in Vite's dev server, what happens to your own source files?","hint":"Think about whether the work happens before anything is served, or later.","explain":"A bundler can finish the whole application before serving anything, so startup grows with app size. Other designs do their work on demand, and that timing decides how fast a page appears.","source":"https://vite.dev/guide/why","interaction":{"type":"single"},"options":[{"id":"a","text":"It bundles every module into one file before serving anything","whyNot":"That is the bundler approach Vite avoids in development; Vite saves bundling for production builds."},{"id":"b","text":"It copies every source file unchanged into the dist folder","whyNot":"dist is the default output folder of vite build, and the dev server serves files from the project instead."},{"id":"c","text":"It transforms each file when the browser asks for it, serving it over native ESM","why":"Vite serves source code on demand over native ESM and transforms each file as the browser requests it."},{"id":"d","text":"It pre-bundles your own source files once and caches them","whyNot":"Pre-bundling is for dependencies that rarely change; your source code is served on demand."}],"answer":"c","explanation":"Vite pre-bundles dependencies once, but serves your source code on demand over native ESM, transforming each file as it is requested.","concept":"Vite pre-bundles dependencies once, but serves your source code on demand over native ESM, transforming each file as it is requested.","rev":1,"updatedAt":"2026-10-26","kind":"scenario","takeaways":["Dependencies are pre-bundled once; your source code is served on demand over native ESM."]},{"id":"vitebeginner-005","courseId":"vite-beginner","domain":"dev-server-and-hmr","topic":"HMR without full reload","prompt":"With Vite's hot module replacement, saving a changed file makes the browser wait for a full rebuild of the app before the change appears.","hint":"Think about how much of the app must be redone to show one edited module.","explain":"A bundler-based dev server recompiles a combined output after each edit. An ESM-based one can send only the changed module. Consider which design the sentence describes.","source":"https://vite.dev/guide/features","interaction":{"type":"true-false"},"options":[{"id":"a","text":"True","whyNot":"Not so: HMR updates the changed module directly and doesn't wait for a rebuild of the whole app."},{"id":"b","text":"False","why":"HMR sends just the changed module to the browser, without a full rebuild being awaited."}],"answer":"b","explanation":"Vite's HMR over native ESM updates just the changed module in the browser, without a full page reload or waiting for a rebuild of the app.","concept":"Vite's HMR over native ESM updates just the changed module in the browser, without a full page reload or waiting for a rebuild of the app.","rev":1,"updatedAt":"2026-10-26","kind":"scenario","takeaways":["HMR updates the changed module, not the whole app, and keeps application state where the framework supports it."]}]