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 Thu, Feb 9, 2023
Paiva
Florian Reuschel
Sébastien Chopin
Daniel Roe
Rishi Raj Jain
Clément Ollivier
Savas Vedova
Steven Soekha
Vinícius Alves
Kareem Dabbeet
Valentín Costa
Ryan Skinner
Alex Hirzel
Ajeet Chaulagain
René Eschke
Nico Devs
Muhammad
Nazaré da Piedade
Naoki Hamada
Tom
Yann Aufray
Anthony Chu
Nuzhat Minhaz
Lucas Portet
Richard Schloss
bpy
Antony Konstantinidis
Hibariya
Jose Seabra
Eze
Florian LEFEBVRE
Lucas Recoaro
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 Eltociear Ashimine
FamCodings
Ayouli
F. Hinkelmann
felipesuri
Christophe Carvalho Vilas-Boas
Leoš Literák
Trizotti