0
0
Vueframework~5 mins

Deployment to static hosting in Vue - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
Anode_modules
Bsrc
Cpublic
Ddist
What does setting publicPath in vue.config.js affect?
AThe port Vue runs on locally
BThe version of Vue used
CWhere Vue looks for assets and files when deployed
DThe style of the app
Which hosting service is NOT typically used for static Vue app hosting?
ANetlify
BHeroku
CGitHub Pages
DVercel
How can you avoid 404 errors on page refresh with Vue Router in history mode on static hosts?
AConfigure the host to fallback to index.html
BUse inline styles
CDisable JavaScript
DUse a different port
What command builds a Vue app for production deployment?
Anpm run build
Bnpm start
Cnpm test
Dnpm install
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.