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 Fri, Dec 23, 2022
Vinícius Alves
Kareem Dabbeet
Clément Ollivier
Valentín Costa
Ryan Skinner
Daniel Roe
Alex Hirzel
Ajeet Chaulagain
René Eschke
Sébastien Chopin
Nico Devs
Muhammad
Nazaré da Piedade
Naoki Hamada
Tom
Yann Aufray
Anthony Chu
Nuzhat Minhaz
Lucas Portet
Richard Schloss
Xanzhu
bpy
Antony Konstantinidis
Hibariya
Jose Seabra
Eze
Florian LEFEBVRE
Lucas
Julien SEIXAS
Hugo
Sylvain Marroufin
Spencer Cooley
Piotr Zatorski
Vladimir Semenov
Harry Allen
kazuya kawaguchi
Unai Mengual
Hyunseung Lee
Alexandre Chopin
pooya parsa
Nick Medrano
Mosaab Emam
Iljs Путлер Капут
Heitor Ramon Ribeiro
Nero
Yoon Han
Ikko Ashimine
FamCodings
Ayouli
F. Hinkelmann
felipesuri
Christophe Carvalho Vilas-Boas
Leoš Literák
Trizotti
Marcello Bachechi
Rodolphe
Thomas Underwood
Shek Evgeniy
Lukasz Formela