nuxt/nuxt
在 GitHub 查看Strange node_modules cache folder after upgrading from version 3.4.1
Open
#20,527 创建于 2023年4月26日
bundler:vitegood first issue🍰 p2-nice-to-have
描述
Environment
$ nuxi info ./src
- Nuxi 3.4.2
- RootDir: D:/Projects/studiomado/backoffice/src
Nuxt project info:
- Operating System: Windows_NT
- Node Version: v16.20.0
- Nuxt Version: 3.4.2
- Nitro Version: 2.3.3
- Package Manager: yarn@1.22.19
- Builder: vite
- User Config: alias, app, css, devtools, experimental, imports, modules, runtimeConfig, ssr, typescript, vite, vue
- Runtime Modules: @nuxt/devtools@0.4.2, nuxt-typed-router@^3.1.5, @vueuse/nuxt@10.1.0, @pinia/nuxt@^0.4.9
- Build Modules: -
Reproduction
Stackblitz (unfortunately the node_modules folder is hidden so you can't see it in this demo)
Describe the bug
An additional node_modules folder is created under the working folder, if nuxt is runned passing the folder as a parameter ex.:
{
"scripts": {
"nuxt:info": "nuxi info ./src",
"dev": "nuxi dev ./src -o",
"build": "nuxi build ./src",
"start": "nuxi start ./src"
}
}

Additional context
From the documentation:
rootDir Type: string Default: "/"
Define the root directory of your application. This property can be overwritten (for example, running nuxt ./my-app/ will set the rootDir to the absolute path of ./my-app/ from the current/working directory. It is normally not needed to configure this option.
From the Vite builder package (maybe related):
async function buildClient(ctx) {
const clientConfig = vite.mergeConfig(ctx.config, {
...,
cacheDir: resolve(ctx.nuxt.options.rootDir, "node_modules/.cache/vite", "client"),
...,
}
}
Logs
No response