The rootDir option is used to define the workspace of your Nuxt app. For example, say you have your project in the following location:
/var/www/html/my-project/
Then, the default value of the rootDir option for your project is /var/www/html/my-project/. However, you can change it by using the Nuxt command in your package.json file, as follows:
// my-project/package.json
{
"scripts": {
"dev": "nuxt ./app/"
}
}
Now, the workspace of your Nuxt app is in /var/www/html/my-project/app/ and your app structure has become the following:
-| my-project/
---| node_modules/
---| app/
------| nuxt.config.js
------| pages/
------| components/
------| ...
---| package.json
Note that now, the Nuxt config file must be put inside the /app/ directory. We will cover the Nuxt commands in Chapter 14, Using Linters, Formatters, and Deployment Commands.
You can find an example app for this option in /chapter-2/configuration/rooDir/ ...