Installing a Nuxt SPA is the same as installing Nuxt universal SSR using the create-nuxt-app scaffolding tool. Let's get started:
- Install a Nuxt project via your terminal using the Nuxt scaffolding tool:
$ npx create-nuxt-app <project-name>
- Answer the questions that appear and pick the Single Page App option when asked for the Rendering mode:
? Project name
? Project description
//...
? Rendering mode:
Universal (SSR / SSG)
> Single Page App
After the installation is completed, if you inspect the Nuxt config file in your project's root directory, you should see that the mode option was configured as an SPA for you during the installation process:
// nuxt.config.js
export default {
mode: 'spa'
}
- Start Nuxt development mode in your terminal:
$ npm run dev
You should see that only the code on the client-side is compiled on your terminal:
✓ Client
Compiled successfully in 1.76s
You will no longer see any code compiled on the...