anton1tech
anton1tech

Reputation: 13

nuxt build (SPA) generetes ./nuxt/dist/**

Whenever I run

$ npm run build

on Nuxt SPA mode it generates a ./dist folder and ./nuxt/dist folder.

What's the use of ./nuxt/dist?

./nuxt/dist folder sample

Upvotes: 1

Views: 2117

Answers (4)

Kelvin Omereshone
Kelvin Omereshone

Reputation: 826

The contents in the nuxt/dist folder are what is going to be served up when you are in production. It contains an optimized code to be served to your users.

Upvotes: 0

Carl Angelo Orale
Carl Angelo Orale

Reputation: 182

.nuxt/dist is for server side rendering it will be use when you run npm run start on your server and it will start listening on localhost:3000

Upvotes: -1

Prashant
Prashant

Reputation: 1385

Nuxt.js lets you upload your dist files to your CDN for maximum performances, simply set the publicPath to your CDN.

export default {
  build: {
    publicPath: 'https://cdn.nuxtjs.org'
  }
}

Then, when launching nuxt build, upload the content of .nuxt/dist/client directory to your CDN.

Ref: https://nuxtjs.org/api/configuration-build/

Upvotes: 1

Cong Nguyen
Cong Nguyen

Reputation: 3455

The dist folder contains html and js files then you can use it to deploy to server and run as statics site.

Upvotes: 4

Related Questions