The srcDir property
Define the source directory of your Nuxt application.
-
Type:
String
- Default: rootDir value
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/
Edit this page on GitHub
Updated at Mon, Aug 19, 2024
Sébastien Chopin
Nazaré da Piedade
Nobu
川音리오
Maciek Palmowski
Nestor Vera
Daniel Roe
Yue Yang
Jeronimas
Clément Ollivier
Alexander Lichter
N3-rd
Adrien Zaganelli
Mag
Stefan Huber
Olga Bulat
Paiva
Florian Reuschel
Savas Vedova
HIJACK
Vinícius Alves
Kareem Dabbeet
Valentín Costa
Ryan Skinner
Alex Hirzel
Ajeet Chaulagain
René Eschke
Nico Devs
Muhammad
Naoki Hamada
Tom
Yann Aufray
Anthony Chu
Nuzhat Minhaz
Lucas Portet
Richard Schloss
Bobby
bpy
Antony Konstantinidis
Hibariya
Jose Seabra
Eze
Florian Lefebvre
Lucas Recoaro
Julien SEIXAS