You are browsing Nuxt 2 docs. Go to Nuxt 3 docs, or learn more about Nuxt 2 Long Term Support.

The srcDir property

Define the source directory of your Nuxt application.


If a relative path is specified it will be relative to the rootDir.

Example 1: Prerequisites:

nuxt.config.js
export default {
  srcDir: 'client/'
}
package.json
  "script": {
    "dev": "yarn nuxt"
  }

works with the following folder structure (note that nuxt.config is listed in the app directory)

-| app/
---| node_modules/
---| nuxt.config.js
---| package.json
---| client/
------| assets/
------| components/
------| layouts/
------| middleware/
------| pages/
------| plugins/
------| static/
------| store/

Example 2:

Instead of example 1 you can also move the nuxt.config into your client folder. In this case you only need to specify client as the rootDir and you can leave srcDir empty:

Prerequisites:

nuxt.config.js
export default {
  srcDir: '' // or just remove it
}
package.json
  "script": {
    "dev": "yarn nuxt client" // this sets client as the rootDir
  }

works with the following folder structure (note that nuxt.config is listed in the client directory)

-| app/
---| node_modules/
---| package.json
---| client/
------| nuxt.config.js
------| assets/
------| components/
------| layouts/
------| middleware/
------| pages/
------| plugins/
------| static/
------| store/