Recall & Review
beginner
What is static hosting in the context of web applications?
Static hosting means serving files like HTML, CSS, and JavaScript directly to users without running server-side code. It is simple and fast, ideal for Vue apps built into static files.
Click to reveal answer
beginner
Which Vue CLI command prepares your app for static hosting?
The command
npm run build or yarn build creates a dist folder with optimized static files ready for deployment.Click to reveal answer
intermediate
Why do you need to set the
publicPath in vue.config.js when deploying to static hosting?Setting
publicPath tells Vue where your app will be served from, so it can correctly link CSS, JS, and assets. For example, if hosted in a subfolder, you set publicPath: '/subfolder/'.Click to reveal answer
beginner
Name two popular static hosting services suitable for Vue apps.
Netlify and GitHub Pages are popular static hosting services. They easily serve Vue's built static files and often support continuous deployment from Git repositories.
Click to reveal answer
intermediate
What is a common issue when deploying Vue apps with client-side routing to static hosts, and how can it be fixed?
Client-side routing can cause 404 errors on page refresh because static hosts look for files matching the URL. Fix this by configuring the host to fallback to
index.html or use hash mode routing.Click to reveal answer
Which folder contains the static files after running
npm run build in a Vue project?✗ Incorrect
The
dist folder holds the optimized static files ready for deployment.What does setting
publicPath in vue.config.js affect?✗ Incorrect
publicPath sets the base URL for assets in the built app.Which hosting service is NOT typically used for static Vue app hosting?
✗ Incorrect
Heroku is mainly for server-side apps, not static hosting.
How can you avoid 404 errors on page refresh with Vue Router in history mode on static hosts?
✗ Incorrect
Fallback to
index.html lets the Vue app handle routing client-side.What command builds a Vue app for production deployment?
✗ Incorrect
npm run build creates the production-ready static files.Explain the steps to deploy a Vue app to a static hosting service.
Think about building, configuring paths, uploading files, and routing setup.
You got /4 concepts.
Describe why client-side routing can cause problems on static hosts and how to solve it.
Consider how static hosts handle URLs and how Vue Router works.
You got /3 concepts.