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?
Think about how URLs for assets are resolved when the base path is not set.
Without setting the publicPath URL, Vue assumes the app is served from the root. This causes asset URLs to be incorrect, so CSS and JS files fail to load, breaking the UI.
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.
Check the official Vue CLI documentation for the correct option name.
The correct option to set the base URL in Vue CLI is publicPath. baseUrl and base are incorrect or deprecated.
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?
Think about how static servers handle URLs and client-side routing.
Static servers serve files based on the URL path. With history mode, URLs look like real paths, but the server does not have those files, causing 404 errors on refresh.
Why might you choose hash mode routing instead of history mode when deploying a Vue app to static hosting?
Consider how static servers handle URLs with hashes versus normal paths.
Hash mode uses the URL fragment (after #), which the server ignores, so no special server setup is needed to serve the app on any route.
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?
Remember how history mode routing works with base URLs.
With publicPath: '/site/' and history mode, the URL reflects the base path plus the route path without hashes.