0👍
I’m not sure if vue.cli would support this feature, although I have a solution that does not use vue.cli but it does belong to the vue.js universe, I’m reffering to the Nuxt.js cli.
You can simply use SPA mode using nuxt --spa
. In combination with the generate feature, it gives you a powerful SPA deployment mechanism without the need to use a Node.js runtime or any special server handling.
The SPA idea is simple! When SPA mode is enabled using mode: ‘spa’ or –spa flag, and we run build, generation automatically starts after the build. This generation contains common meta and resource links, but not page content – this one you’ll have to create on your own of course, but you won’t need to worry about SEO matters on your static code.
So, for an SPA deployment, you must do the following:
- Change mode in nuxt.config.js to spa.
- Run npm run build.
- Deploy the created dist/ folder to your static hosting like Surge, GitHub Pages or nginx.
More on:
https://nuxtjs.org/guide/#single-page-applications-spa-
https://nuxtjs.org/guide/commands#single-page-application-deployment-spa-
If nuxt.js is totally new to you, there’s a nice introduction on the official website:
https://nuxtjs.org/guide
Hope it helps