0
0
Vueframework~20 mins

Deployment to static hosting in Vue - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Vue Static Deployment Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
component_behavior
intermediate
2:00remaining
What happens when you deploy a Vue app without configuring the base URL for static hosting?

You deploy a Vue 3 app to a static hosting service under a subfolder (e.g., https://example.com/myapp/) but forget to set the base option in vue.config.js. What will users most likely experience?

AStatic assets like CSS and JS fail to load, causing a broken UI.
BThe app loads correctly with all routes working as expected.
CThe app redirects users to the root domain instead of the subfolder.
DThe app shows a blank page with no errors in the console.
Attempts:
2 left
💡 Hint

Think about how URLs for assets are resolved when the base path is not set.

📝 Syntax
intermediate
2:00remaining
Which vue.config.js snippet correctly sets the base URL for deploying to /app/ on static hosting?

Choose the correct syntax to configure Vue CLI to serve the app from the /app/ subfolder.

Amodule.exports = { baseUrl: '/app/' }
Bmodule.exports = { publicPath: '/app/' }
Cmodule.exports = { base: '/app/' }
Dexport default { publicPath: '/app/' }
Attempts:
2 left
💡 Hint

Check the official Vue CLI documentation for the correct option name.

🔧 Debug
advanced
2:00remaining
Why does the Vue app show 404 errors on page refresh after deployment to static hosting?

You deployed a Vue app using history mode for routing on static hosting. When you refresh a page other than the root, you get a 404 error. Why?

AVue Router is not installed properly in the project.
BThe app's <code>publicPath</code> is set incorrectly causing asset loading errors.
CStatic hosting does not support client-side routing with history mode by default.
DThe app's main <code>index.html</code> file is missing from the deployment.
Attempts:
2 left
💡 Hint

Think about how static servers handle URLs and client-side routing.

🧠 Conceptual
advanced
2:00remaining
What is the main advantage of using hash mode routing for Vue apps on static hosting?

Why might you choose hash mode routing instead of history mode when deploying a Vue app to static hosting?

AHash mode routing improves SEO by creating clean URLs.
BHash mode routing reduces the app bundle size significantly.
CHash mode routing enables server-side rendering automatically.
DHash mode routing allows the app to work without server-side configuration for route fallback.
Attempts:
2 left
💡 Hint

Consider how static servers handle URLs with hashes versus normal paths.

state_output
expert
2:00remaining
What is the final URL in the browser after deploying a Vue app with publicPath: '/site/' and navigating to /site/dashboard using history mode?

You deployed a Vue app with publicPath set to /site/. The app uses Vue Router in history mode. You navigate inside the app to the dashboard page. What URL will the browser show?

Ahttps://example.com/site/dashboard
Bhttps://example.com/site/#/dashboard
Chttps://example.com/dashboard
Dhttps://example.com/#/dashboard
Attempts:
2 left
💡 Hint

Remember how history mode routing works with base URLs.